##Deseq2
library(tximport)
library(readr)
library(DESeq2)
## Le chargement a nécessité le package : S4Vectors
## Le chargement a nécessité le package : stats4
## Le chargement a nécessité le package : BiocGenerics
## 
## Attachement du package : 'BiocGenerics'
## Les objets suivants sont masqués depuis 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## Les objets suivants sont masqués depuis 'package:base':
## 
##     anyDuplicated, aperm, append, as.data.frame, basename, cbind,
##     colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
##     get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
##     match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
##     Position, rank, rbind, Reduce, rownames, sapply, saveRDS, setdiff,
##     table, tapply, union, unique, unsplit, which.max, which.min
## 
## Attachement du package : 'S4Vectors'
## L'objet suivant est masqué depuis 'package:utils':
## 
##     findMatches
## Les objets suivants sont masqués depuis 'package:base':
## 
##     expand.grid, I, unname
## Le chargement a nécessité le package : IRanges
## 
## Attachement du package : 'IRanges'
## L'objet suivant est masqué depuis 'package:grDevices':
## 
##     windows
## Le chargement a nécessité le package : GenomicRanges
## Le chargement a nécessité le package : GenomeInfoDb
## Le chargement a nécessité le package : SummarizedExperiment
## Le chargement a nécessité le package : MatrixGenerics
## Le chargement a nécessité le package : matrixStats
## 
## Attachement du package : 'MatrixGenerics'
## Les objets suivants sont masqués depuis 'package:matrixStats':
## 
##     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
##     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
##     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
##     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
##     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
##     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
##     colWeightedMeans, colWeightedMedians, colWeightedSds,
##     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
##     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
##     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
##     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
##     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
##     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
##     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
##     rowWeightedSds, rowWeightedVars
## Le chargement a nécessité le package : Biobase
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## 
## Attachement du package : 'Biobase'
## L'objet suivant est masqué depuis 'package:MatrixGenerics':
## 
##     rowMedians
## Les objets suivants sont masqués depuis 'package:matrixStats':
## 
##     anyMissing, rowMedians
library(rhdf5)
library(readxl)
library(readr)
library(dplyr)
## 
## Attachement du package : 'dplyr'
## L'objet suivant est masqué depuis 'package:Biobase':
## 
##     combine
## L'objet suivant est masqué depuis 'package:matrixStats':
## 
##     count
## Les objets suivants sont masqués depuis 'package:GenomicRanges':
## 
##     intersect, setdiff, union
## L'objet suivant est masqué depuis 'package:GenomeInfoDb':
## 
##     intersect
## Les objets suivants sont masqués depuis 'package:IRanges':
## 
##     collapse, desc, intersect, setdiff, slice, union
## Les objets suivants sont masqués depuis 'package:S4Vectors':
## 
##     first, intersect, rename, setdiff, setequal, union
## Les objets suivants sont masqués depuis 'package:BiocGenerics':
## 
##     combine, intersect, setdiff, union
## Les objets suivants sont masqués depuis 'package:stats':
## 
##     filter, lag
## Les objets suivants sont masqués depuis 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(ggpubr)
library(plotrix)
library(vsn)
library(pheatmap)
library(RColorBrewer)
library(ggfortify)
library(FactoMineR)
library(factoextra)
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(gridExtra)
## 
## Attachement du package : 'gridExtra'
## L'objet suivant est masqué depuis 'package:dplyr':
## 
##     combine
## L'objet suivant est masqué depuis 'package:Biobase':
## 
##     combine
## L'objet suivant est masqué depuis 'package:BiocGenerics':
## 
##     combine
library(eba)
library(ade4)
## 
## Attachement du package : 'ade4'
## L'objet suivant est masqué depuis 'package:FactoMineR':
## 
##     reconst
## L'objet suivant est masqué depuis 'package:GenomicRanges':
## 
##     score
## L'objet suivant est masqué depuis 'package:BiocGenerics':
## 
##     score
##TopGO et ClusterProfiler
library(DESeq2)
library(ggplot2)
library(dplyr)
library(readr)
library(Rgraphviz)
## Le chargement a nécessité le package : graph
## Le chargement a nécessité le package : grid
## 
## Attachement du package : 'Rgraphviz'
## Les objets suivants sont masqués depuis 'package:IRanges':
## 
##     from, to
## Les objets suivants sont masqués depuis 'package:S4Vectors':
## 
##     from, to
library(topGO)
## Le chargement a nécessité le package : GO.db
## Le chargement a nécessité le package : AnnotationDbi
## 
## Attachement du package : 'AnnotationDbi'
## L'objet suivant est masqué depuis 'package:dplyr':
## 
##     select
## 
## Le chargement a nécessité le package : SparseM
## 
## groupGOTerms:    GOBPTerm, GOMFTerm, GOCCTerm environments built.
## 
## Attachement du package : 'topGO'
## L'objet suivant est masqué depuis 'package:grid':
## 
##     depth
## L'objet suivant est masqué depuis 'package:IRanges':
## 
##     members
library(httr)
## 
## Attachement du package : 'httr'
## L'objet suivant est masqué depuis 'package:Biobase':
## 
##     content
library(jsonlite)
library(clusterProfiler)
## clusterProfiler v4.14.6 Learn more at https://yulab-smu.top/contribution-knowledge-mining/
## 
## Please cite:
## 
## G Yu. Thirteen years of clusterProfiler. The Innovation. 2024,
## 5(6):100722
## 
## Attachement du package : 'clusterProfiler'
## L'objet suivant est masqué depuis 'package:AnnotationDbi':
## 
##     select
## L'objet suivant est masqué depuis 'package:IRanges':
## 
##     slice
## L'objet suivant est masqué depuis 'package:S4Vectors':
## 
##     rename
## L'objet suivant est masqué depuis 'package:stats':
## 
##     filter
library(stringr)
## 
## Attachement du package : 'stringr'
## L'objet suivant est masqué depuis 'package:graph':
## 
##     boundary
library(tibble)
library(gridExtra)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats   1.0.0     ✔ purrr     1.0.4
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ lubridate::%within%()     masks IRanges::%within%()
## ✖ stringr::boundary()       masks graph::boundary()
## ✖ dplyr::collapse()         masks IRanges::collapse()
## ✖ gridExtra::combine()      masks dplyr::combine(), Biobase::combine(), BiocGenerics::combine()
## ✖ httr::content()           masks Biobase::content()
## ✖ dplyr::count()            masks matrixStats::count()
## ✖ dplyr::desc()             masks IRanges::desc()
## ✖ tidyr::expand()           masks S4Vectors::expand()
## ✖ clusterProfiler::filter() masks dplyr::filter(), stats::filter()
## ✖ dplyr::first()            masks S4Vectors::first()
## ✖ purrr::flatten()          masks jsonlite::flatten()
## ✖ dplyr::lag()              masks stats::lag()
## ✖ ggplot2::Position()       masks BiocGenerics::Position(), base::Position()
## ✖ purrr::reduce()           masks GenomicRanges::reduce(), IRanges::reduce()
## ✖ clusterProfiler::rename() masks dplyr::rename(), S4Vectors::rename()
## ✖ lubridate::second()       masks S4Vectors::second()
## ✖ lubridate::second<-()     masks S4Vectors::second<-()
## ✖ clusterProfiler::select() masks AnnotationDbi::select(), dplyr::select()
## ✖ purrr::simplify()         masks clusterProfiler::simplify()
## ✖ clusterProfiler::slice()  masks dplyr::slice(), IRanges::slice()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
##UpSetR
library(UpSetR)
library(ComplexUpset)
## 
## Attachement du package : 'ComplexUpset'
## 
## L'objet suivant est masqué depuis 'package:UpSetR':
## 
##     upset
library(ggplot2)
library(dplyr)
library(tidyr)

1 Deseq2 analysis

1.1 Plant

1.1.1 Import des données pour l’analyse Deseq2 sur les échantillons issus des plantes

# Lire la table de metadata (avec sample, condition, chemin des fichiers)
metadata <- read_excel("metadata_coldata.xlsx", 
    sheet = "Plant_L")

# Lire la correspondance transcript-gène
tx2gene <- read.table("rquantif/Plant/gene_to_transcript.txt", sep="\t",
                      header=FALSE) 
tx2gene <- tx2gene[, c(2, 1)]
assoc_orga <- read.table("rquantif/assoc_orga.txt", sep=",", header=FALSE) 

# Ajouter une colonne vide pour orga
tx2gene$orga <- NA

# Boucle pour faire les correspondances partiels
for (i in 1:nrow(assoc_orga)) {
  pattern <- assoc_orga$V1[i]
  orga_value <- assoc_orga$V2[i]
  
  # Chercher les lignes dont transcript_id contient le pattern
  match_idx <- grep(pattern, tx2gene$V2)
  
  # Ajouter l'orga correspondante
  tx2gene$orga[match_idx] <- orga_value
}
# Vérifier
head(tx2gene)
##                                             V2
## 1 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338
## 2 lcl|CAKKNF020000001.1_cds_CAH0746831.1_16339
## 3 lcl|CAKKNF020000001.1_cds_CAH0746832.1_16340
## 4 lcl|CAKKNF020000001.1_cds_CAH0746833.1_16341
## 5 lcl|CAKKNF020000001.1_cds_CAH0746834.1_16342
## 6 lcl|CAKKNF020000001.1_cds_CAH0746835.1_16343
##                                             V1     orga
## 1 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338  Bemisia
## 2 lcl|CAKKNF020000001.1_cds_CAH0746831.1_16339  Bemisia
## 3 lcl|CAKKNF020000001.1_cds_CAH0746832.1_16340  Bemisia
## 4 lcl|CAKKNF020000001.1_cds_CAH0746833.1_16341  Bemisia
## 5 lcl|CAKKNF020000001.1_cds_CAH0746834.1_16342  Bemisia
## 6 lcl|CAKKNF020000001.1_cds_CAH0746835.1_16343  Bemisia
# Charger les fichiers dans tximport
files <- setNames(metadata$file, metadata$sample)

tx2gene$orga <- trimws(tx2gene$orga)
tx2gene_tomato = subset(tx2gene, orga == "Tomato")
tx2gene_virus = subset(tx2gene, orga == "TYLCV")

h5closeAll()
txi_tomato <- tximport(files, type="kallisto", tx2gene = tx2gene_tomato, 
                       ignoreTxVersion=FALSE)
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
## transcripts missing from tx2gene: 28329
## summarizing abundance
## summarizing counts
## summarizing length
## summarizing inferential replicates
head(txi_tomato$counts)
##                                               P1L      P2L      P3L      P4L
## lcl|NC_007898.3_cds_YP_008563067.1_44305   20.000   31.000   68.500  21.0000
## lcl|NC_007898.3_cds_YP_008563068.1_44306 1682.668 1923.747 1355.941 774.0872
## lcl|NC_007898.3_cds_YP_008563069.1_44307    0.000    0.000    0.000   0.0000
## lcl|NC_007898.3_cds_YP_008563070.1_44308  104.000  172.000  132.000  99.0000
## lcl|NC_007898.3_cds_YP_008563071.1_44309  212.000  302.000  200.000 314.0000
## lcl|NC_007898.3_cds_YP_008563072.1_44310  148.000  353.000   54.000 187.0000
##                                               P5L     P6L      P7L     P8L
## lcl|NC_007898.3_cds_YP_008563067.1_44305  15.0000   26.00  28.0000   30.50
## lcl|NC_007898.3_cds_YP_008563068.1_44306 658.9715 1846.49 808.8525 1571.64
## lcl|NC_007898.3_cds_YP_008563069.1_44307   0.0000    0.00   0.0000    0.00
## lcl|NC_007898.3_cds_YP_008563070.1_44308  71.0000  112.00  73.0000   76.00
## lcl|NC_007898.3_cds_YP_008563071.1_44309 116.0000  387.00 228.0000  151.00
## lcl|NC_007898.3_cds_YP_008563072.1_44310 132.0000  179.00 171.0000   85.00
##                                               P9L     P10L     P11L     P12L
## lcl|NC_007898.3_cds_YP_008563067.1_44305   43.500   31.500   20.000   31.000
## lcl|NC_007898.3_cds_YP_008563068.1_44306 1157.977 1677.013 1588.374 5712.037
## lcl|NC_007898.3_cds_YP_008563069.1_44307    0.000    0.000    0.000    0.000
## lcl|NC_007898.3_cds_YP_008563070.1_44308  142.000  118.000  115.000  424.000
## lcl|NC_007898.3_cds_YP_008563071.1_44309  359.000  374.000  170.000  172.000
## lcl|NC_007898.3_cds_YP_008563072.1_44310  228.000  201.000   96.000  326.000
##                                             P13L     P14L     P15L     P16L
## lcl|NC_007898.3_cds_YP_008563067.1_44305  38.000   34.000   91.500  22.5000
## lcl|NC_007898.3_cds_YP_008563068.1_44306 954.512 1335.165 1485.537 894.2578
## lcl|NC_007898.3_cds_YP_008563069.1_44307   0.000    0.000    0.000   0.0000
## lcl|NC_007898.3_cds_YP_008563070.1_44308 116.000   86.000  199.000  67.0000
## lcl|NC_007898.3_cds_YP_008563071.1_44309 361.000  210.000  367.000 166.0000
## lcl|NC_007898.3_cds_YP_008563072.1_44310 202.000  190.000  217.000 126.0000
##                                              P17L       P18L      P19L     P20L
## lcl|NC_007898.3_cds_YP_008563067.1_44305   43.500  45.500000  24.50000  56.0000
## lcl|NC_007898.3_cds_YP_008563068.1_44306 1172.157 725.754170  80.51105 991.6025
## lcl|NC_007898.3_cds_YP_008563069.1_44307    0.000   1.739267   0.00000   0.0000
## lcl|NC_007898.3_cds_YP_008563070.1_44308  153.000 118.000000  64.00000 109.0000
## lcl|NC_007898.3_cds_YP_008563071.1_44309  332.000 314.000000 215.00000 436.0000
## lcl|NC_007898.3_cds_YP_008563072.1_44310  210.000 141.000000 110.00000 200.0000
##                                              P21L    P22L        P23L     P24L
## lcl|NC_007898.3_cds_YP_008563067.1_44305   51.000   30.50   41.500000   55.500
## lcl|NC_007898.3_cds_YP_008563068.1_44306 2350.673 3282.23 1028.449665 3739.596
## lcl|NC_007898.3_cds_YP_008563069.1_44307    0.000    0.00    1.628528    0.000
## lcl|NC_007898.3_cds_YP_008563070.1_44308  136.000   98.00  116.000000  167.000
## lcl|NC_007898.3_cds_YP_008563071.1_44309  428.000  274.00  494.000000  489.000
## lcl|NC_007898.3_cds_YP_008563072.1_44310  284.000  133.00  232.000000  373.000
metadata_virus <- metadata[grepl("V", metadata$condition), ]
files_virus <- setNames(metadata_virus$file, metadata_virus$sample)
h5closeAll()
txi_virus <- tximport(files_virus, type="kallisto", tx2gene = tx2gene_virus, 
                      ignoreTxVersion=FALSE)
## 1 2 3 4 5 6 7 8 9 10 11 12 
## transcripts missing from tx2gene: 72714
## summarizing abundance
## summarizing counts
## summarizing length
## summarizing inferential replicates
head(txi_virus$counts)
##                                         P4L       P5L       P6L      P10L
## lcl|NC_004005.1_cds_NP_658991.1_1  766.6021  173.5676  603.2835  385.1499
## lcl|NC_004005.1_cds_NP_658992.1_2 4610.3979 1298.4324 3026.7165 1940.8501
## lcl|NC_004005.1_cds_NP_658993.1_3  435.2293  223.3472  250.8378  111.9367
## lcl|NC_004005.1_cds_NP_658994.1_4  652.7707  398.6528  464.1622  258.0633
## lcl|NC_004005.1_cds_NP_658995.1_5  429.0000  326.0000  240.3006  216.0000
## lcl|NC_004005.1_cds_NP_658996.1_6    0.0000    0.0000    8.6994    0.0000
##                                        P11L       P12L      P16L      P17L
## lcl|NC_004005.1_cds_NP_658991.1_1  159.3277   6.749435 11143.098  5232.300
## lcl|NC_004005.1_cds_NP_658992.1_2 1365.6723 824.250565 46933.902 27241.700
## lcl|NC_004005.1_cds_NP_658993.1_3  169.5604 197.197788  2800.160  1937.213
## lcl|NC_004005.1_cds_NP_658994.1_4  278.4396 197.802212  4308.128  2751.787
## lcl|NC_004005.1_cds_NP_658995.1_5  244.0000  83.000000  3919.711  2527.000
## lcl|NC_004005.1_cds_NP_658996.1_6    0.0000   0.000000     0.000     0.000
##                                        P18L      P22L      P23L      P24L
## lcl|NC_004005.1_cds_NP_658991.1_1  9633.980  3240.605  6985.227  6360.615
## lcl|NC_004005.1_cds_NP_658992.1_2 45496.020 15950.395 34657.773 42542.385
## lcl|NC_004005.1_cds_NP_658993.1_3  2863.081  1288.546  2391.800  3894.182
## lcl|NC_004005.1_cds_NP_658994.1_4  4207.919  2260.454  3444.030  5211.818
## lcl|NC_004005.1_cds_NP_658995.1_5  3602.000  2025.000  2937.170  4126.000
## lcl|NC_004005.1_cds_NP_658996.1_6     0.000     0.000     0.000     0.000

1.1.2 Formalisations des données

#Tomate
dds_tomato <- DESeqDataSetFromTximport(txi_tomato, colData=metadata, 
                                       design=~condition)
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
## using counts and average transcript lengths from tximport
dds_tomato <- dds_tomato[ rowSums(counts(dds_tomato)) > 10, ]
#Keep only genes with at least 10 count
dds_tomato.deseq.para <- DESeq(dds_tomato,fitType = "parametric")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
residual.para <- log(mcols(dds_tomato.deseq.para)$dispGeneEst) - 
  log(mcols(dds_tomato.deseq.para)$dispFit)
median(abs(residual.para))
## [1] 1.265786
plotDispEsts(dds_tomato.deseq.para)

dds_tomato.deseq.local <- DESeq(dds_tomato,fitType = "local")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
residual.local <- log(mcols(dds_tomato.deseq.local)$dispGeneEst) - 
  log(mcols(dds_tomato.deseq.local)$dispFit)
median(abs(residual.local))
## [1] 0.9909089
plotDispEsts(dds_tomato.deseq.local)

dds_tomato.deseq.mean <- DESeq(dds_tomato,fitType = "mean")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
residual.mean <- log(mcols(dds_tomato.deseq.mean)$dispGeneEst) - 
  log(mcols(dds_tomato.deseq.mean)$dispFit)
median(abs(residual.mean))
## [1] 2.41282
plotDispEsts(dds_tomato.deseq.mean)

dds_tomato.deseq <- DESeq(dds_tomato,fitType = "local")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
dds_tomato.deseq.counts <- round(counts(dds_tomato.deseq,normalized=TRUE))
#write.csv(dds_tomato.deseq.counts, 
#          "rquantif/Plant/dds_tomato_deseq_counts_hisat2.txt")

#Virus
dds_virus <- DESeqDataSetFromTximport(txi_virus, colData=metadata_virus, 
                                      design=~condition)
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
## using counts and average transcript lengths from tximport
dds_virus <- dds_virus[ rowSums(counts(dds_virus)) > 10, ]
#Keep only genes with at least 10 count

dds_virus$condition <- droplevels(dds_virus$condition)

dds_virus.deseq.para <- DESeq(dds_virus, fitType = "parametric")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## -- note: fitType='parametric', but the dispersion trend was not well captured by the
##    function: y = a/x + b, and a local regression fit was automatically substituted.
##    specify fitType='local' or 'mean' to avoid this message next time.
## Warning in lfproc(x, y, weights = weights, cens = cens, base = base, geth =
## geth, : Estimated rdf < 1.0; not estimating variance
## final dispersion estimates
## fitting model and testing
residual.para <- log(mcols(dds_virus.deseq.para)$dispGeneEst) - 
  log(mcols(dds_virus.deseq.para)$dispFit)
median(abs(residual.para))
## [1] 0.03586308
plotDispEsts(dds_virus.deseq.para)

dds_virus.deseq.local <- DESeq(dds_virus,fitType = "local")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## Warning in lfproc(x, y, weights = weights, cens = cens, base = base, geth =
## geth, : Estimated rdf < 1.0; not estimating variance
## final dispersion estimates
## fitting model and testing
residual.local <- log(mcols(dds_virus.deseq.local)$dispGeneEst) - 
  log(mcols(dds_virus.deseq.local)$dispFit)
median(abs(residual.local))
## [1] 0.03586308
plotDispEsts(dds_virus.deseq.local)
dds_virus.deseq.mean <- DESeq(dds_virus,fitType = "mean")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
residual.mean <- log(mcols(dds_virus.deseq.mean)$dispGeneEst) -
  log(mcols(dds_virus.deseq.mean)$dispFit)
median(abs(residual.mean))
## [1] 1.289039
plotDispEsts(dds_virus.deseq.mean)

dds_virus.deseq <- DESeq(dds_virus,fitType = "local")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## Warning in lfproc(x, y, weights = weights, cens = cens, base = base, geth =
## geth, : Estimated rdf < 1.0; not estimating variance
## final dispersion estimates
## fitting model and testing
dds_virus.deseq.counts <- round(counts(dds_virus.deseq,normalized=TRUE))
#write.csv(dds_virus.deseq.counts, 
#          "rquantif/Plant/dds_virus_deseq_counts_hisat2.txt")

1.1.3 Tests et représentations graphiques

vsd <- varianceStabilizingTransformation(dds_tomato, blind = FALSE)
## using 'avgTxLength' from assays(dds), correcting for library size
rld <- rlog(dds_tomato, blind=FALSE)
## using 'avgTxLength' from assays(dds), correcting for library size
head(assay(vsd), 3)
##                                                P1L       P2L       P3L      P4L
## lcl|NC_007898.3_cds_YP_008563067.1_44305  7.063662  7.206476  7.418755 6.993896
## lcl|NC_007898.3_cds_YP_008563068.1_44306 11.151251 11.234681 10.251883 9.877188
## lcl|NC_007898.3_cds_YP_008563070.1_44308  8.029941  8.369559  7.859792 7.820386
##                                                P5L       P6L       P7L
## lcl|NC_007898.3_cds_YP_008563067.1_44305  6.982082  7.021020  7.189539
## lcl|NC_007898.3_cds_YP_008563068.1_44306 10.037657 10.808059 10.146244
## lcl|NC_007898.3_cds_YP_008563070.1_44308  7.800118  7.812033  7.739915
##                                                P8L       P9L      P10L
## lcl|NC_007898.3_cds_YP_008563067.1_44305  7.091689  7.243019  7.093312
## lcl|NC_007898.3_cds_YP_008563068.1_44306 10.603838 10.138855 10.595053
## lcl|NC_007898.3_cds_YP_008563070.1_44308  7.578648  7.974042  7.823986
##                                               P11L      P12L      P13L
## lcl|NC_007898.3_cds_YP_008563067.1_44305  7.081925  7.208884  7.243324
## lcl|NC_007898.3_cds_YP_008563068.1_44306 11.130602 12.862203 10.152165
## lcl|NC_007898.3_cds_YP_008563070.1_44308  8.150603  9.276197  7.928782
##                                               P14L      P15L     P16L      P17L
## lcl|NC_007898.3_cds_YP_008563067.1_44305  7.285930  7.683955 6.908109  7.203986
## lcl|NC_007898.3_cds_YP_008563068.1_44306 10.788626 10.536555 9.671919 10.081642
## lcl|NC_007898.3_cds_YP_008563070.1_44308  7.849409  8.284181 7.395246  7.967945
##                                              P18L     P19L     P20L      P21L
## lcl|NC_007898.3_cds_YP_008563067.1_44305 7.242041 6.978935  7.43112  7.373606
## lcl|NC_007898.3_cds_YP_008563068.1_44306 9.508453 7.571700 10.14196 11.251043
## lcl|NC_007898.3_cds_YP_008563070.1_44308 7.819165 7.428170  7.86061  8.027686
##                                               P22L      P23L      P24L
## lcl|NC_007898.3_cds_YP_008563067.1_44305  7.195493  7.235949  7.483043
## lcl|NC_007898.3_cds_YP_008563068.1_44306 11.941074 10.061428 12.042462
## lcl|NC_007898.3_cds_YP_008563070.1_44308  7.908311  7.850255  8.291659
ntd <- normTransform(dds_tomato)
## using 'avgTxLength' from assays(dds), correcting for library size
count.plot <- meanSdPlot(assay(dds_tomato))$gg

ntd.plot <- meanSdPlot(assay(ntd))$gg

vsd.plot <- meanSdPlot(assay(vsd))$gg

rld.plot <- meanSdPlot(assay(rld))$gg

ggarrange(count.plot,ntd.plot,vsd.plot,rld.plot, 
          labels=c("counts","ntd","vst","rlog"),ncol=2,nrow=2)

df <- bind_rows(
  as_tibble(assay(ntd)[, 1:2]) %>% mutate(transformation = "ntd"),
  as_tibble(assay(vsd)[, 1:2]) %>% mutate(transformation = "vst"),
  as_tibble(assay(rld)[, 1:2]) %>% mutate(transformation = "rlog"))
colnames(df)[1:2] <- c("x", "y")  
lvls <- c("ntd", "vst", "rlog")
df$transformation <- factor(df$transformation, levels=lvls)
g = ggplot(df, aes(x = x, y = y)) + geom_hex(bins = 80) +
  coord_fixed() + facet_grid( . ~ transformation)  
print(g)

select <- order(rowMeans(counts(dds_tomato.deseq,normalized=TRUE)),
                decreasing=TRUE)
df <- as.data.frame(colData(dds_tomato.deseq)[,"sample"])

wss <- sapply(1:10, function(k) {
  kmeans(assay(ntd)[select, ], centers = k, nstart = 10, algorithm = "Lloyd", 
         iter.max = 1000)$tot.withinss
})

# 1. Heatmap avec ntd
pheatmap(assay(ntd)[select,],
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = 500)

# 2. Heatmap avec vsd
pheatmap(assay(vsd)[select,],
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = 500)

# 3. Heatmap avec rld
pheatmap(assay(rld)[select,],
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = 500)

# 4. Heatmap des distances entre échantillons
sampleDists <- dist(t(assay(vsd)))
sampleDistMatrix <- as.matrix(sampleDists)
rownames(sampleDistMatrix) <- paste(vsd$condition, vsd$type, sep = "-")
colnames(sampleDistMatrix) <- NULL
colors <- colorRampPalette(rev(brewer.pal(9, "Blues")))(255)

pheatmap(sampleDistMatrix,
         clustering_distance_rows = sampleDists,
         clustering_distance_cols = sampleDists,
         col = colors)

vst_df1 <- as.data.frame(t(assay(vsd)))
vst_df1$Treatment <- metadata$condition 
pca <- prcomp(vst_df1[,1:ncol(vst_df1)-1])

# Effectuer l'analyse PCA
pca_facto <- PCA(vst_df1[,1:ncol(vst_df1)-1], graph = FALSE)

# Préparer un PDF pour sauvegarde
#pdf("rquantif/Plant/PCA_FactoMineR_Plant_results.pdf", width = 10, height = 12)

## 1. Scree plot
print(fviz_screeplot(pca_facto, addlabels = TRUE, ylim = c(0, 70)))

## 2. Représentation des individus
print(fviz_pca_ind(pca_facto, axes = c(1, 2), repel = TRUE))

## 3. Cos2 des individus - Axe 1 & 2 côte à côte
p1 <- fviz_cos2(pca_facto, choice = "ind", axes = 1, 
                title = "Qualité de représentation (cos2) - Axe 1")
p2 <- fviz_cos2(pca_facto, choice = "ind", axes = 2,
                title = "Qualité de représentation (cos2) - Axe 2")
grid.arrange(p1, p2, ncol = 2)

## 4. Contributions des individus - Axe 1 & 2 côte à côte
p3 <- fviz_contrib(pca_facto, choice = "ind", axes = 1,
                   title = "Contribution des individus - Axe 1")
p4 <- fviz_contrib(pca_facto, choice = "ind", axes = 2, 
                   title = "Contribution des individus - Axe 2")
grid.arrange(p3, p4, ncol = 2)

## 5. Représentation colorée par cos2
print(fviz_pca_ind(pca_facto, repel = TRUE, col.ind = "cos2", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
                  axes = c(1, 2), title = "Individus - Colorés par cos2"))

## 6. Représentation colorée par contribution
print(fviz_pca_ind(pca_facto, repel = TRUE, col.ind = "contrib", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
                  axes = c(1, 2),
                  title = "Individus - Colorés par contribution"))

## 7. Variables les plus contributrices (Top 5)
print(fviz_pca_var(pca_facto, col.var = "contrib", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
                  axes = c(1, 2), repel = TRUE, 
                  select.var = list(contrib = 5),
                  title = "Variables - Top 5 contributions"))

# 1. Extraire uniquement les données numériques
X <- vst_df1[, 1:(ncol(vst_df1) - 1)]
groupes <- as.factor(vst_df1$Treatment)

# 2. Analyse en composantes principales avec dudi.pca
acp <- dudi.pca(X, scannf = FALSE, nf = 5)

# 3. Analyse entre groupes (between-class analysis)
acp_btw <- ade4:::between(acp, groupes, scannf = FALSE, nf = 5)
## Warning in ade4:::between(acp, groupes, scannf = FALSE, nf = 5): To avoid some
## name conflicts, the 'between' function is now deprecated. Please use 'bca'
## instead
# 4. Visualisation
s.class(acp_btw$ls, fac = groupes, col = c("steelblue", "tomato", "darkgreen"),
        sub = "Projection des individus entre groupes")

# Fermer le PDF
#dev.off()

df_pca <- as.data.frame(pca$x)
df_pca$Treatment <- metadata$condition 
head(df_pca)
##            PC1        PC2       PC3        PC4        PC5        PC6
## P1L -47.721497 -16.718596 -24.29568  15.517044 -21.316953 20.8505165
## P2L  -7.776144  91.688901 -20.39078 -14.553629   1.621508 44.5101583
## P3L -79.590820 -24.985952 115.46807 -33.991554   4.939961 12.1663139
## P4L -21.450694  -4.998577 -24.42886  -1.089912 -15.790559 16.3963204
## P5L -74.153950 -28.790244 -37.69835   4.879195  35.128426 13.1148585
## P6L -11.936260 -15.044593 -15.99511  -1.673811 -37.997066  0.1654554
##             PC7       PC8        PC9       PC10       PC11       PC12
## P1L  15.6981504 25.347012 -10.422114 -0.8932647   7.840784   6.814074
## P2L -11.7791161 -9.503607 -13.468573 -5.8593826 -16.923205 -22.067135
## P3L  -5.4523083  1.334541   6.891136  1.8821953  -8.530346   2.724801
## P4L   1.5401095  6.874333  19.122595  0.7707734   5.862071  17.100817
## P5L  -9.2204986 -2.647387  -4.689710  8.0829171   9.637693  20.803175
## P6L   0.8109608  7.265476  13.644624  7.2722881 -14.137346   4.314608
##           PC13        PC14       PC15        PC16       PC17       PC18
## P1L   5.805118  21.1783826  11.645073 -25.3649444 -1.3714993 -5.9418137
## P2L -15.464384   0.8376284   2.205112  -0.1374990 -0.1559933  1.4193702
## P3L   2.294475   3.7711934   2.283892  -0.5504851  1.0115857 -0.2391166
## P4L -10.458641 -26.6730001  19.572605   6.8170163 -1.2664933  5.8444222
## P5L -11.761873  13.0991974 -16.082145  16.0088748 -0.1293119  0.7763312
## P6L  -4.793326  -2.3224832  -8.616272   6.6571989  9.5406358  8.6911042
##            PC19       PC20       PC21       PC22       PC23          PC24
## P1L  -0.6653093 -2.8500083  -1.815240  0.1169869  0.3158526  1.264389e-13
## P2L   1.0888365  0.7219588  -0.554614  0.9957477 -0.2807660 -3.402869e-13
## P3L   0.5645408 -0.5701483   2.130396 -1.8498739 -1.6033081  3.989092e-14
## P4L   8.1667135 -7.6844202  15.075258 -2.4564095 -2.4295560  1.151172e-13
## P5L   3.8643069  5.0572379  -3.097019  6.6563617  1.4055893 -9.513108e-14
## P6L -27.2601324  8.5459262 -11.525632 -6.7461873  5.4166250  1.557680e-13
##       Treatment
## P1L   P_t1_Q21L
## P2L   P_t1_Q21L
## P3L   P_t1_Q21L
## P4L P_t1_Q21V_L
## P5L P_t1_Q21V_L
## P6L P_t1_Q21V_L
percentage <- round(pca$sdev^2 / sum(pca$sdev^2) * 100, 2)  
percentage <- paste( colnames(df_pca), "(",
                     paste( as.character(percentage), "%", ")", sep="") )
g = ggplot(df_pca, aes(PC1, PC2, color=Treatment)) + geom_point(size=2) +
  xlab(percentage[1]) + ylab(percentage[2]) + 
  theme(axis.text.x = element_text(family = "Times"),
        axis.title.x = element_text(family = "Times", face = "bold"), 
        axis.text.y = element_text(family = "Times"), 
        axis.title.y = element_text(family = "Times", face = "bold"), 
        legend.title = element_text(family = "Times", face = "bold"), 
        legend.text = element_text(family = "Times")) + 
  scale_colour_hue(name = "Condition") 
print(g)
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): famille de
## police introuvable dans la base de données des polices Windows
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): famille de
## police introuvable dans la base de données des polices Windows
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows

# Calcul des loadings
loadings <- as.data.frame(pca$rotation[,1:2])
loadings$gene <- rownames(loadings)

# Pour ne garder que les 20 plus contributeurs (par ex.)
top_contributors <- loadings[order(abs(loadings$PC1) + abs(loadings$PC2), 
                                   decreasing = TRUE),][1:20,]
# Graphique biplot
ggplot(df_pca, aes(PC1, PC2), size=2) +
  geom_segment(data=top_contributors, aes(x=0, y=0, xend=PC1*5, yend=PC2*5), 
               arrow=arrow(length=unit(0.2,"cm")), color="gray40") +
  geom_text(data=top_contributors, aes(x=PC1*5, y=PC2*5, label=gene), 
            size=3, vjust=1, hjust=1) +
  xlab(percentage[1]) + ylab(percentage[2]) +
  theme_minimal() +
  scale_colour_hue(name = "Condition")

select_cond=c("P_t1_Q11L, P_t1_Q11V_L", "P_t1_Q21L, P_t1_Q21V_L", "P_t2_Q11L, 
              P_t2_Q11V_L", "P_t2_Q21L, P_t2_Q21V_L", "P_t1_Q11V_L, 
              P_t2_Q11V_L", "P_t1_Q21V_L, P_t2_Q21V_L", "P_t1_Q11L, P_t2_Q11L", 
              "P_t1_Q21L, P_t2_Q21L", "P_t1_Q11L, P_t1_Q21L", "P_t1_Q11V_L, 
              P_t1_Q21V_L", "P_t2_Q11L, P_t2_Q21L", "P_t2_Q11V_L, P_t2_Q21V_L")
select_cond="P_t1_Q11L, P_t1_Q21L"

resultsNames(dds_tomato.deseq) #verification
## [1] "Intercept"                          "condition_P_t1_Q11V_L_vs_P_t1_Q11L"
## [3] "condition_P_t1_Q21L_vs_P_t1_Q11L"   "condition_P_t1_Q21V_L_vs_P_t1_Q11L"
## [5] "condition_P_t2_Q11L_vs_P_t1_Q11L"   "condition_P_t2_Q11V_L_vs_P_t1_Q11L"
## [7] "condition_P_t2_Q21L_vs_P_t1_Q11L"   "condition_P_t2_Q21V_L_vs_P_t1_Q11L"
for (i in seq_along(select_cond)) {
  # Séparer les deux IDs par la virgule
  ids <- strsplit(select_cond[i], ",\\s*")[[1]]
  ID1 <- ids[1]
  ID2 <- ids[2]

  res.F <- results(dds_tomato.deseq,contrast = c("condition", ID1, ID2))
  res.F$padj <- p.adjust(res.F$pvalue, method = "fdr") 
  #the padj is by FDR that is less restricted then bonfferoni(BH)
  res.F <- res.F[order(res.F$padj), ]
  sig_genes.res.F <- row.names(res.F)[which(abs(res.F$padj) < 0.05)]  
  #catch significant genes between the plants
  file_name= paste0("rquantif/Plant/DESeq2_Results_res.P_", 
                    ID1, "_VS_", ID2, ".txt")
#  write.csv(res.F, file_name)
  
#  if (length(sig_genes.res.F) > 0){
#    write.csv(res.F[sig_genes.res.F,], file_name)
#  }
  # Ajouter une colonne pour log2FC et -log10(padj)
  res.F$log2FoldChange[is.na(res.F$log2FoldChange)] <- 0
  res.F$padj[is.na(res.F$padj)] <- 1
  res.F$negLogP <- -log10(res.F$padj)
  
  # Ajouter une colonne de statut
  res.F$status <- "Non significatif"
  res.F$status[res.F$padj < 0.05 & res.F$log2FoldChange > 0] <- "Sur-exprimé"
  res.F$status[res.F$padj < 0.05 & res.F$log2FoldChange < 0] <- "Sous-exprimé"
  
  # Définir des couleurs accessibles (daltonien-friendly)
  colors <- c(
    "Sur-exprimé" = "#D55E00",      # orange
    "Sous-exprimé" = "#0072B2",     # bleu
    "Non significatif" = "gray70"
  )
  
  # Tracer le volcano plot
  g <- ggplot(res.F, aes(x = log2FoldChange, y = negLogP, color = status)) +
    geom_point(alpha = 0.8, size = 1.5) +
    scale_color_manual(values = colors) +
    geom_vline(xintercept = 0, color = '#a2a2a2', 
                  alpha=0.7, linewidth = 0.2) +
    theme_light() +
    labs(title = paste(ID1, "vs", ID2),
         x = "log2(Fold Change)", y = "-log10(p-adj)") 
  print(g)
#  ggsave(paste("rquantif/Plant/DESeq2_Results_res.P_", ID1, '_', ID2, '.pdf'),
#         plot = g)
}

vsd <- varianceStabilizingTransformation(dds_virus, blind = FALSE)
## using 'avgTxLength' from assays(dds), correcting for library size
## -- note: fitType='parametric', but the dispersion trend was not well captured by the
##    function: y = a/x + b, and a local regression fit was automatically substituted.
##    specify fitType='local' or 'mean' to avoid this message next time.
## Warning in lfproc(x, y, weights = weights, cens = cens, base = base, geth =
## geth, : Estimated rdf < 1.0; not estimating variance
rld <- rlog(dds_virus, blind=FALSE)
## using 'avgTxLength' from assays(dds), correcting for library size
## -- note: fitType='parametric', but the dispersion trend was not well captured by the
##    function: y = a/x + b, and a local regression fit was automatically substituted.
##    specify fitType='local' or 'mean' to avoid this message next time.
## Warning in lfproc(x, y, weights = weights, cens = cens, base = base, geth =
## geth, : Estimated rdf < 1.0; not estimating variance
head(assay(vsd), 3)
##                                        P4L      P5L      P6L     P10L     P11L
## lcl|NC_004005.1_cds_NP_658991.1_1 11.64901 10.47116 11.72816 11.73527 10.55861
## lcl|NC_004005.1_cds_NP_658992.1_2 12.93963 12.01717 12.93963 12.93963 12.46655
## lcl|NC_004005.1_cds_NP_658993.1_3 10.63179 10.60390 10.54038 10.41963 10.60390
##                                       P12L     P16L     P17L     P18L     P22L
## lcl|NC_004005.1_cds_NP_658991.1_1 10.30715 11.80530 11.75777 11.80195 11.73462
## lcl|NC_004005.1_cds_NP_658992.1_2 12.93963 13.33214 13.16227 13.42752 12.93075
## lcl|NC_004005.1_cds_NP_658993.1_3 11.75629 10.50967 10.54269 10.58001 10.52799
##                                       P23L     P24L
## lcl|NC_004005.1_cds_NP_658991.1_1 11.78472 11.50757
## lcl|NC_004005.1_cds_NP_658992.1_2 13.30588 12.94142
## lcl|NC_004005.1_cds_NP_658993.1_3 10.57994 10.60390
ntd <- normTransform(dds_virus)
## using 'avgTxLength' from assays(dds), correcting for library size
count.plot <- meanSdPlot(assay(dds_virus))$gg
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_line()`).

ntd.plot <- meanSdPlot(assay(ntd))$gg
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_line()`).

vsd.plot <- meanSdPlot(assay(vsd))$gg
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_line()`).

rld.plot <- meanSdPlot(assay(rld))$gg
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_line()`).

ggarrange(count.plot,ntd.plot,vsd.plot,rld.plot, 
          labels=c("counts","ntd","vst","rlog"),ncol=2,nrow=2)
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Removed 5 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Removed 5 rows containing missing values or values outside the scale range
## (`geom_line()`).

df <- bind_rows(
  as_tibble(assay(ntd)[, 1:2]) %>% mutate(transformation = "ntd"),
  as_tibble(assay(vsd)[, 1:2]) %>% mutate(transformation = "vst"),
  as_tibble(assay(rld)[, 1:2]) %>% mutate(transformation = "rlog"))
colnames(df)[1:2] <- c("x", "y")  
lvls <- c("ntd", "vst", "rlog")
df$transformation <- factor(df$transformation, levels=lvls)
g = ggplot(df, aes(x = x, y = y)) + geom_hex(bins = 80) +
  coord_fixed() + facet_grid( . ~ transformation)  
print(g)

select <- order(rowMeans(counts(dds_virus.deseq,normalized=TRUE)),
                decreasing=TRUE)
df <- as.data.frame(colData(dds_virus.deseq)[,"sample"])

subset_data_ntd <- assay(ntd)[sample(select, size = 1000, replace = TRUE), ]
subset_data_vsd <- assay(vsd)[sample(select, size = 1000, replace = TRUE), ]
subset_data_rld <- assay(rld)[sample(select, size = 1000, replace = TRUE), ]

data_mat_ntd <- subset_data_ntd
data_mat_ntd <- unique(data_mat_ntd)  # enlève les doublons exacts
data_mat_ntd <- jitter(data_mat_ntd)

data_mat_vsd <- subset_data_vsd
data_mat_vsd <- unique(data_mat_vsd)  # enlève les doublons exacts
data_mat_vsd <- jitter(data_mat_vsd)

data_mat_rld <- subset_data_rld
data_mat_rld <- unique(data_mat_rld)  # enlève les doublons exacts
data_mat_rld <- jitter(data_mat_rld)

k_val_ntd <- min(500, nrow(unique(subset_data_ntd)))
k_val_vsd <- min(500, nrow(unique(subset_data_vsd)))
k_val_rld <- min(500, nrow(unique(subset_data_rld)))

wss <- sapply(1:k_val_ntd, function(k) {
  kmeans(data_mat_ntd, centers = k, nstart = 10, algorithm = "Lloyd", 
         iter.max = 1000)$tot.withinss
})

sampleDists <- dist(t(assay(vsd)))
sampleDistMatrix <- as.matrix(sampleDists)
rownames(sampleDistMatrix) <- paste(vsd$condition, vsd$type, sep = "-")
colnames(sampleDistMatrix) <- NULL
colors <- colorRampPalette(rev(brewer.pal(9, "Blues")))(255)

# 1. Heatmap avec ntd
pheatmap(subset_data_ntd,
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = k_val_ntd)

# 2. Heatmap avec vsd
pheatmap(subset_data_vsd,
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = k_val_vsd)

# 3. Heatmap avec rld
pheatmap(subset_data_rld,
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = k_val_rld)

# 4. Heatmap des distances entre échantillons
pheatmap(sampleDistMatrix,
         clustering_distance_rows = sampleDists,
         clustering_distance_cols = sampleDists,
         col = colors)

vst_df1 <- as.data.frame(t(assay(vsd)))
vst_df1$Treatment <- metadata_virus$condition 
pca <- prcomp(vst_df1[,1:ncol(vst_df1)-1])

# Effectuer l'analyse PCA
pca_facto <- PCA(vst_df1[,1:ncol(vst_df1)-1], graph = FALSE)

# Préparer un PDF pour sauvegarde
#pdf("rquantif/Plant/PCA_FactoMineR_Virus_results.pdf", width = 10, height = 12)

## 1. Scree plot
print(fviz_screeplot(pca_facto, addlabels = TRUE, ylim = c(0, 70)))

## 2. Représentation des individus
print(fviz_pca_ind(pca_facto, axes = c(1, 2), repel = TRUE))

## 3. Cos2 des individus - Axe 1 & 2 côte à côte
p1 <- fviz_cos2(pca_facto, choice = "ind", axes = 1,
                title = "Qualité de représentation (cos2) - Axe 1")
p2 <- fviz_cos2(pca_facto, choice = "ind", axes = 2,
                title = "Qualité de représentation (cos2) - Axe 2")
grid.arrange(p1, p2, ncol = 2)

## 4. Contributions des individus - Axe 1 & 2 côte à côte
p3 <- fviz_contrib(pca_facto, choice = "ind", axes = 1,
                   title = "Contribution des individus - Axe 1")
p4 <- fviz_contrib(pca_facto, choice = "ind", axes = 2, 
                   title = "Contribution des individus - Axe 2")
grid.arrange(p3, p4, ncol = 2)

## 5. Représentation colorée par cos2
print(fviz_pca_ind(pca_facto, repel = TRUE, col.ind = "cos2", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
                  axes = c(1, 2), title = "Individus - Colorés par cos2"))

## 6. Représentation colorée par contribution
print(fviz_pca_ind(pca_facto, repel = TRUE, col.ind = "contrib", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
                  axes = c(1, 2), 
                  title = "Individus - Colorés par contribution"))

## 7. Variables les plus contributrices (Top 5)
print(fviz_pca_var(pca_facto, col.var = "contrib", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
                  axes = c(1, 2), repel = TRUE, 
                  select.var = list(contrib = 5),
                  title = "Variables - Top 5 contributions"))

# 1. Extraire uniquement les données numériques
X <- vst_df1[, 1:(ncol(vst_df1) - 1)]
groupes <- as.factor(vst_df1$Treatment)

# 2. Analyse en composantes principales avec dudi.pca
acp <- dudi.pca(X, scannf = FALSE, nf = 5)

# 3. Analyse entre groupes (between-class analysis)
acp_btw <- ade4:::between(acp, groupes, scannf = FALSE, nf = 5)
## Warning in ade4:::between(acp, groupes, scannf = FALSE, nf = 5): To avoid some
## name conflicts, the 'between' function is now deprecated. Please use 'bca'
## instead
# 4. Visualisation
s.class(acp_btw$ls, fac = groupes, col = c("steelblue", "tomato", "darkgreen"),
        sub = "Projection des individus entre groupes")

# Fermer le PDF
#dev.off()

df_pca <- as.data.frame(pca$x)
df_pca$Treatment <- metadata_virus$condition 
head(df_pca)
##             PC1         PC2          PC3         PC4          PC5   Treatment
## P4L  -0.2175420 -0.04102003  0.251588750 -0.05098803  0.023097121 P_t1_Q21V_L
## P5L   1.2623778  0.61943168  0.020078684 -0.02824930  0.042601053 P_t1_Q21V_L
## P6L  -0.2797546 -0.01389344  0.438587198 -0.01529059 -0.075378955 P_t1_Q21V_L
## P10L -0.3358726  0.21141546  0.087908989  0.04787067  0.007369528 P_t1_Q11V_L
## P11L  0.9584303  0.35221482 -0.170120181 -0.01678115 -0.128378719 P_t1_Q11V_L
## P12L  1.2963841 -0.95733280  0.003659814  0.04877545  0.033097805 P_t1_Q11V_L
percentage <- round(pca$sdev^2 / sum(pca$sdev^2) * 100, 2)  
percentage <- paste( colnames(df_pca), "(", 
                     paste( as.character(percentage), "%", ")", sep="") )
g = ggplot(df_pca, aes(PC1, PC2, color=Treatment)) + geom_point(size=2) + 
  xlab(percentage[1]) + ylab(percentage[2]) + 
  theme(axis.text.x = element_text(family = "Times"), 
        axis.title.x = element_text(family = "Times", face = "bold"), 
        axis.text.y = element_text(family = "Times"), 
        axis.title.y = element_text(family = "Times", face = "bold"),
        legend.title = element_text(family = "Times", face = "bold"),
        legend.text = element_text(family = "Times")) + 
  scale_colour_hue(name = "Condition")
print(g)
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows

select_cond_virus=c("P_t1_Q11V_L, P_t2_Q11V_L", "P_t1_Q21V_L, P_t2_Q21V_L", 
                    "P_t1_Q11V_L, P_t1_Q21V_L", "P_t2_Q11V_L, P_t2_Q21V_L")

for (i in seq_along(select_cond_virus)) {
  # Séparer les deux IDs par la virgule
  ids <- strsplit(select_cond_virus[i], ",\\s*")[[1]]
  ID1 <- ids[1]
  ID2 <- ids[2]

  res.F <- results(dds_virus.deseq ,contrast = c("condition", ID1, ID2))
  res.F$padj <- p.adjust(res.F$pvalue, method = "fdr") 
  #the padj is by FDR that is less restricted then bonfferoni(BH)
  res.F <- res.F[order(res.F$padj), ]
  sig_genes.res.F <- row.names(res.F)[which(abs(res.F$padj) < 0.05)]  
  #catch significant genes between the plants
  file_name= paste0("rquantif/Plant/DESeq2_Results_res.V_", 
                    ID1, "_VS_", ID2, ".txt")
#  write.csv(res.F, file_name)
  
#  if (length(sig_genes.res.F) > 0){
#    write.csv(res.F[sig_genes.res.F,], file_name)
#  }
  # Ajouter une colonne pour log2FC et -log10(padj)
  res.F$log2FoldChange[is.na(res.F$log2FoldChange)] <- 0
  res.F$padj[is.na(res.F$padj)] <- 1
  res.F$negLogP <- -log10(res.F$padj)
  
  # Ajouter une colonne de statut
  res.F$status <- "Non significatif"
  res.F$status[res.F$padj < 0.05 & res.F$log2FoldChange > 0] <- "Sur-exprimé"
  res.F$status[res.F$padj < 0.05 & res.F$log2FoldChange < 0] <- "Sous-exprimé"
  
  # Définir des couleurs accessibles (daltonien-friendly)
  colors <- c(
    "Sur-exprimé" = "#D55E00",      # orange
    "Sous-exprimé" = "#0072B2",     # bleu clair
    "Non significatif" = "gray70"
  )
  
  # Tracer le volcano plot
  g <- ggplot(res.F, aes(x = log2FoldChange, y = negLogP, color = status)) +
    geom_point(alpha = 0.8, size = 1.5) +
    scale_color_manual(values = colors) +
    geom_vline(xintercept = 0, color = '#a2a2a2', 
                  alpha=0.7, linewidth = 0.2) +
    theme_light() +
    labs(title = paste(ID1, "vs", ID2),
         x = "log2(Fold Change)", y = "-log10(p-adj)") 
  print(g)
#  ggsave(paste("rquantif/Plant/DESeq2_Results_res.V_", ID1, '_', ID2, '.pdf'),
#         plot = g)
}

1.2 Insect

1.2.1 Import des données pour l’analyse Deseq2 sur les échantillons issus des insectes

# Lire la table de metadata (avec sample, condition, chemin des fichiers)
metadata <- read_excel("metadata_coldata.xlsx", 
    sheet = "Insect_L")

# Lire la correspondance transcript-gène
tx2gene <- read.table("rquantif/Insect/gene_to_transcript.txt", sep=",", 
                      header=FALSE) 
tx2gene <- tx2gene[, c(2, 1)]
assoc_orga <- read.table("rquantif/assoc_orga.txt", sep=",", header=FALSE) 

# Ajouter une colonne vide pour orga
tx2gene$orga <- NA

# Boucle pour faire les correspondances partiels
for (i in 1:nrow(assoc_orga)) {
  pattern <- assoc_orga$V1[i]
  orga_value <- assoc_orga$V2[i]
  
  # Chercher les lignes dont transcript_id contient le pattern
  match_idx <- grep(pattern, tx2gene$V2)
  
  # Ajouter l'orga correspondante
  tx2gene$orga[match_idx] <- orga_value
}
# Vérifier
head(tx2gene)
##                                  V2                                V1   orga
## 1 lcl|NC_004005.1_cds_NP_658991.1_1 lcl|NC_004005.1_cds_NP_658991.1_1  TYLCV
## 2 lcl|NC_004005.1_cds_NP_658992.1_2 lcl|NC_004005.1_cds_NP_658992.1_2  TYLCV
## 3 lcl|NC_004005.1_cds_NP_658993.1_3 lcl|NC_004005.1_cds_NP_658993.1_3  TYLCV
## 4 lcl|NC_004005.1_cds_NP_658994.1_4 lcl|NC_004005.1_cds_NP_658994.1_4  TYLCV
## 5 lcl|NC_004005.1_cds_NP_658995.1_5 lcl|NC_004005.1_cds_NP_658995.1_5  TYLCV
## 6 lcl|NC_004005.1_cds_NP_658996.1_6 lcl|NC_004005.1_cds_NP_658996.1_6  TYLCV
# Charger les fichiers dans tximport
files <- setNames(metadata$file, metadata$sample)

tx2gene$orga <- trimws(tx2gene$orga)
cytotype =c("Hamiltonella", "Wolbachia", "Rickettsia", "Portiera", "Cardinium", 
            "Arsenophonus")
tx2gene_bemisia = subset(tx2gene, orga == "Bemisia")
tx2gene_virus = subset(tx2gene, orga == "TYLCV")
tx2gene_cytotype = subset(tx2gene, orga %in% cytotype)

h5closeAll()
txi_bemisia <- tximport(files, type="kallisto", tx2gene = tx2gene_bemisia, 
                       ignoreTxVersion=FALSE)
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 
## transcripts missing from tx2gene: 6937
## summarizing abundance
## summarizing counts
## summarizing length
## summarizing inferential replicates
head(txi_bemisia$counts)
##                                          B1L    B2L    B3L   B4L    B5L    B6L
## lcl|NC_006279.1_cds_YP_086802.1_24446 114507 112165 121026 37204 113676 151078
## lcl|NC_006279.1_cds_YP_086803.1_24447    221    213    305    62    304    394
## lcl|NC_006279.1_cds_YP_086804.1_24448      0      1      0     0      0      0
## lcl|NC_006279.1_cds_YP_086805.1_24449      0      0      0     0      3      8
## lcl|NC_006279.1_cds_YP_086806.1_24450  31592  27449  39731 12785  31043  42125
## lcl|NC_006279.1_cds_YP_086807.1_24451     38     45     50    24     39     50
##                                          B7L    B8L    B9L   B10L   B11L   B12L
## lcl|NC_006279.1_cds_YP_086802.1_24446 159440 134268 115555 115838 116060 126121
## lcl|NC_006279.1_cds_YP_086803.1_24447    328    323    242    343    335    302
## lcl|NC_006279.1_cds_YP_086804.1_24448      0      2      3      0      0      0
## lcl|NC_006279.1_cds_YP_086805.1_24449      0      1      2      3      0      3
## lcl|NC_006279.1_cds_YP_086806.1_24450  33145  40829  34005  39736  49424  45166
## lcl|NC_006279.1_cds_YP_086807.1_24451     80     60     52     37     57     64
##                                         B13L   B14L  B15L   B16L   B17L  B18L
## lcl|NC_006279.1_cds_YP_086802.1_24446 134732 127325 94869 101006 128671 81004
## lcl|NC_006279.1_cds_YP_086803.1_24447    359    409   303    203    353   224
## lcl|NC_006279.1_cds_YP_086804.1_24448      0      0     1      0      1     0
## lcl|NC_006279.1_cds_YP_086805.1_24449      0      0     6      5      0     0
## lcl|NC_006279.1_cds_YP_086806.1_24450  46365  43089 43291  38493  37777 39135
## lcl|NC_006279.1_cds_YP_086807.1_24451     59     67    49     53     50    59
##                                         B19L  B20L   B21L   B22L   B23L   B24L
## lcl|NC_006279.1_cds_YP_086802.1_24446 131911 86853 136689 123783 118626 144844
## lcl|NC_006279.1_cds_YP_086803.1_24447    376   274    252    271    251    262
## lcl|NC_006279.1_cds_YP_086804.1_24448      0     3      0      0      0      1
## lcl|NC_006279.1_cds_YP_086805.1_24449      3     9      2      3      0      0
## lcl|NC_006279.1_cds_YP_086806.1_24450  44849 42426  26984  27503  30192  29078
## lcl|NC_006279.1_cds_YP_086807.1_24451     63    49     46     47     50     48
##                                         B25L   B26L   B27L   B28L   B29L   B30L
## lcl|NC_006279.1_cds_YP_086802.1_24446 114377 121210 140690 102575 129635 152923
## lcl|NC_006279.1_cds_YP_086803.1_24447    217    302    270    161    223    297
## lcl|NC_006279.1_cds_YP_086804.1_24448      0      0      0      0      0      1
## lcl|NC_006279.1_cds_YP_086805.1_24449      0      0      0      0      1      1
## lcl|NC_006279.1_cds_YP_086806.1_24450  24546  25044  24553  22472  28591  25869
## lcl|NC_006279.1_cds_YP_086807.1_24451     29     41     50     39     46     40
##                                         B31L   B32L   B33L   B34L   B35L  B36L
## lcl|NC_006279.1_cds_YP_086802.1_24446 112152 102532 112740 130904 113000 97698
## lcl|NC_006279.1_cds_YP_086803.1_24447    261    263    305    348    401   270
## lcl|NC_006279.1_cds_YP_086804.1_24448      0      0      0      0      0     0
## lcl|NC_006279.1_cds_YP_086805.1_24449      0      1      3      0      2     1
## lcl|NC_006279.1_cds_YP_086806.1_24450  30202  28873  23768  28082  27139 26420
## lcl|NC_006279.1_cds_YP_086807.1_24451     57     48     43     43     55    48
##                                         B37L  B38L   B39L   B40L
## lcl|NC_006279.1_cds_YP_086802.1_24446 101896 98883 134259 153763
## lcl|NC_006279.1_cds_YP_086803.1_24447    243   189    379    417
## lcl|NC_006279.1_cds_YP_086804.1_24448      0     0      0      1
## lcl|NC_006279.1_cds_YP_086805.1_24449      0     2      0      0
## lcl|NC_006279.1_cds_YP_086806.1_24450  28795 30697  31594  31322
## lcl|NC_006279.1_cds_YP_086807.1_24451     47    47     35     52
metadata_virus <- metadata[grepl("V", metadata$condition), ]
files_virus <- setNames(metadata_virus$file, metadata_virus$sample)
h5closeAll()
txi_virus <- tximport(files_virus, type="kallisto", tx2gene = tx2gene_virus, 
                      ignoreTxVersion=FALSE)
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
## transcripts missing from tx2gene: 31389
## summarizing abundance
## summarizing counts
## summarizing length
## summarizing inferential replicates
verif=txi_virus$counts != 0
head(txi_virus$counts[verif]) #pas de virus ID
## numeric(0)
h5closeAll()
txi_cytotype <- tximport(files, type="kallisto", tx2gene = tx2gene_cytotype, 
                         ignoreTxVersion=FALSE)
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 
## transcripts missing from tx2gene: 24516
## summarizing abundance
## summarizing counts
## summarizing length
## summarizing inferential replicates
head(txi_cytotype$counts)
##                                     B1L B2L B3L B4L B5L B6L B7L B8L B9L B10L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 126 118 241 179 253 205 401 247 219  251
## lcl|NC_018618.1_cds_PAQ_RS00835_147 217 136 334 222 296 298 497 325 447  362
## lcl|NC_018618.1_cds_PAQ_RS01200_210  19  13  30  34  28  25  59  45  40   26
## lcl|NC_018618.1_cds_PAQ_RS01515_168  13   6  17   4  21  13  20  23  13    9
## lcl|NC_018618.1_cds_PAQ_RS01615_197  33  28  56  34  40  54  72  74  48   87
## lcl|NC_018618.1_cds_PAQ_RS01620_198  46  62  68  29  82  67 144  75  69  113
##                                     B11L B12L B13L B14L B15L B16L B17L B18L
## lcl|NC_018618.1_cds_PAQ_RS00660_119   25   12   10   12    4    7   16    7
## lcl|NC_018618.1_cds_PAQ_RS00835_147   13   18   10   28   23   11   30   16
## lcl|NC_018618.1_cds_PAQ_RS01200_210    3    1    0    0    0    1    1    0
## lcl|NC_018618.1_cds_PAQ_RS01515_168    7    6    5   10    7    6    8    1
## lcl|NC_018618.1_cds_PAQ_RS01615_197   12    4    3    2    2    0    2    0
## lcl|NC_018618.1_cds_PAQ_RS01620_198    3    8    0    1    0    2    5    0
##                                     B19L B20L B21L B22L B23L B24L B25L B26L
## lcl|NC_018618.1_cds_PAQ_RS00660_119   24    8   54   32   50  191  121  172
## lcl|NC_018618.1_cds_PAQ_RS00835_147    6   37   57   58   70  195  181  245
## lcl|NC_018618.1_cds_PAQ_RS01200_210    3    0    5    4    4   12   12   11
## lcl|NC_018618.1_cds_PAQ_RS01515_168    8   17    8    2   22   28   15   35
## lcl|NC_018618.1_cds_PAQ_RS01615_197    6    4    9   21   22   21   18   47
## lcl|NC_018618.1_cds_PAQ_RS01620_198    0   12   13   14   15   56   39   62
##                                     B27L B28L B29L B30L B31L B32L B33L B34L
## lcl|NC_018618.1_cds_PAQ_RS00660_119  374  188  292  326   34   64   37   53
## lcl|NC_018618.1_cds_PAQ_RS00835_147  404  310  331  391  101   96   59  106
## lcl|NC_018618.1_cds_PAQ_RS01200_210   81   18   19   21    7    4    4   10
## lcl|NC_018618.1_cds_PAQ_RS01515_168   31   17   25   32    7   12   21   11
## lcl|NC_018618.1_cds_PAQ_RS01615_197   43   44   47   53   42   11    8   13
## lcl|NC_018618.1_cds_PAQ_RS01620_198  176   85   96  139   22   11   22   36
##                                     B35L B36L B37L B38L B39L B40L
## lcl|NC_018618.1_cds_PAQ_RS00660_119   54   27   42   66  151  154
## lcl|NC_018618.1_cds_PAQ_RS00835_147   49   66   93  134  299  240
## lcl|NC_018618.1_cds_PAQ_RS01200_210    6    0    6    5   12   11
## lcl|NC_018618.1_cds_PAQ_RS01515_168   12   18   34   10   28   23
## lcl|NC_018618.1_cds_PAQ_RS01615_197   16    7   17   19   40   42
## lcl|NC_018618.1_cds_PAQ_RS01620_198   15   19   28   29   53   83

1.2.2 Formalisations des données

#Tomate
dds_bemisia <- DESeqDataSetFromTximport(txi_bemisia, colData=metadata, 
                                       design=~condition)
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
## using counts and average transcript lengths from tximport
dds_bemisia <- dds_bemisia[ rowSums(counts(dds_bemisia)) > 10, ]
#Keep only genes with at least 10 count
dds_bemisia.deseq.para <- DESeq(dds_bemisia,fitType = "parametric")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## -- note: fitType='parametric', but the dispersion trend was not well captured by the
##    function: y = a/x + b, and a local regression fit was automatically substituted.
##    specify fitType='local' or 'mean' to avoid this message next time.
## final dispersion estimates
## fitting model and testing
residual.para <- log(mcols(dds_bemisia.deseq.para)$dispGeneEst) - 
  log(mcols(dds_bemisia.deseq.para)$dispFit)
median(abs(residual.para))
## [1] 1.054587
plotDispEsts(dds_bemisia.deseq.para)

dds_bemisia.deseq.local <- DESeq(dds_bemisia,fitType = "local")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
residual.local <- log(mcols(dds_bemisia.deseq.local)$dispGeneEst) - 
  log(mcols(dds_bemisia.deseq.local)$dispFit)
median(abs(residual.local))
## [1] 1.054587
plotDispEsts(dds_bemisia.deseq.local)
dds_bemisia.deseq.mean <- DESeq(dds_bemisia,fitType = "mean")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
residual.mean <- log(mcols(dds_bemisia.deseq.mean)$dispGeneEst) - 
  log(mcols(dds_bemisia.deseq.mean)$dispFit)
median(abs(residual.mean))
## [1] 4.641961
plotDispEsts(dds_bemisia.deseq.mean)

dds_bemisia.deseq <- DESeq(dds_bemisia,fitType = "local")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
dds_bemisia.deseq.counts <- round(counts(dds_bemisia.deseq,normalized=TRUE))
#write.csv(dds_bemisia.deseq.counts, 
#          "rquantif/Insect/dds_bemisia_deseq_counts_hisat2.txt")

#cytotype
dds_cytotype <- DESeqDataSetFromTximport(txi_cytotype, colData=metadata, 
                                      design=~condition)
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
## using counts and average transcript lengths from tximport
dds_cytotype <- dds_cytotype[ rowSums(counts(dds_cytotype)) > 10, ]
#Keep only genes with at least 10 count

dds_cytotype$condition <- droplevels(dds_cytotype$condition)

dds_cytotype.deseq.para <- DESeq(dds_cytotype, fitType = "parametric")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## -- note: fitType='parametric', but the dispersion trend was not well captured by the
##    function: y = a/x + b, and a local regression fit was automatically substituted.
##    specify fitType='local' or 'mean' to avoid this message next time.
## final dispersion estimates
## fitting model and testing
residual.para <- log(mcols(dds_cytotype.deseq.para)$dispGeneEst) - 
  log(mcols(dds_cytotype.deseq.para)$dispFit)
median(abs(residual.para))
## [1] 0.6503324
plotDispEsts(dds_cytotype.deseq.para)

dds_cytotype.deseq.local <- DESeq(dds_cytotype,fitType = "local")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
residual.local <- log(mcols(dds_cytotype.deseq.local)$dispGeneEst) - 
  log(mcols(dds_cytotype.deseq.local)$dispFit)
median(abs(residual.local))
## [1] 0.6503324
plotDispEsts(dds_cytotype.deseq.local)
dds_cytotype.deseq.mean <- DESeq(dds_cytotype,fitType = "mean")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
residual.mean <- log(mcols(dds_cytotype.deseq.mean)$dispGeneEst) -
  log(mcols(dds_cytotype.deseq.mean)$dispFit)
median(abs(residual.mean))
## [1] 4.073161
plotDispEsts(dds_cytotype.deseq.mean)

dds_cytotype.deseq <- DESeq(dds_cytotype,fitType = "local")
## estimating size factors
## using 'avgTxLength' from assays(dds), correcting for library size
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
dds_cytotype.deseq.counts <- round(counts(dds_cytotype.deseq,normalized=TRUE))
#write.csv(dds_cytotype.deseq.counts, 
#          "rquantif/Insect/dds_cytotype_deseq_counts_hisat2.txt")

1.2.3 Tests et représentations graphiques

vsd <- varianceStabilizingTransformation(dds_bemisia, blind = FALSE)
## using 'avgTxLength' from assays(dds), correcting for library size
## -- note: fitType='parametric', but the dispersion trend was not well captured by the
##    function: y = a/x + b, and a local regression fit was automatically substituted.
##    specify fitType='local' or 'mean' to avoid this message next time.
rld <- rlog(dds_bemisia, blind=FALSE)
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## using 'avgTxLength' from assays(dds), correcting for library size
## -- note: fitType='parametric', but the dispersion trend was not well captured by the
##    function: y = a/x + b, and a local regression fit was automatically substituted.
##    specify fitType='local' or 'mean' to avoid this message next time.
head(assay(vsd), 3)
##                                             B1L       B2L       B3L       B4L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.941846 17.118678 16.683228 15.247989
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.615270  8.704093  8.676746  7.851619
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.274131  7.353408  7.274131  7.274131
##                                             B5L       B6L       B7L       B8L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.885229 17.102543 17.187546 16.979308
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.853551  8.979451  8.811217  8.822157
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.274131  7.274131  7.274131  7.371332
##                                             B9L      B10L      B11L      B12L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.679205 16.752761 16.756295 16.986432
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.523509  8.854137  8.833905  8.815047
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.388140  7.274131  7.274131  7.274131
##                                            B13L      B14L      B15L      B16L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.863746 16.924688 16.416272 16.602616
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.833321  9.048018  8.706069  8.458048
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.274131  7.274131  7.340384  7.274131
##                                            B17L      B18L      B19L      B20L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.807159 16.360720 17.072427 16.468104
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.825435  8.553817  9.032587  8.722351
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.341766  7.274131  7.274131  7.394502
##                                            B21L      B22L      B23L      B24L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.868506 16.697757 16.797784 16.981177
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.539820  8.570163  8.606861  8.586812
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.274131  7.274131  7.274131  7.339801
##                                            B25L      B26L      B27L      B28L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.633542 16.780078 17.010947 16.704975
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.436662  8.728692  8.658573  8.343867
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.274131  7.274131  7.274131  7.274131
##                                            B29L      B30L      B31L      B32L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.847342 16.979081 16.586589 16.526562
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.481850  8.643622  8.561243  8.599278
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.274131  7.339549  7.274131  7.274131
##                                            B33L      B34L      B35L      B36L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.971020 16.979765 16.784877 16.368846
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.926320  8.914770  9.039495  8.563703
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.274131  7.274131  7.274131  7.274131
##                                            B37L      B38L      B39L      B40L
## lcl|NC_006279.1_cds_YP_086802.1_24446 16.402700 16.343102 16.741629 16.964754
## lcl|NC_006279.1_cds_YP_086803.1_24447  8.475403  8.298439  8.812452  8.923078
## lcl|NC_006279.1_cds_YP_086804.1_24448  7.274131  7.274131  7.274131  7.339355
ntd <- normTransform(dds_bemisia)
## using 'avgTxLength' from assays(dds), correcting for library size
count.plot <- meanSdPlot(assay(dds_bemisia))$gg

ntd.plot <- meanSdPlot(assay(ntd))$gg

vsd.plot <- meanSdPlot(assay(vsd))$gg

rld.plot <- meanSdPlot(assay(rld))$gg

ggarrange(count.plot,ntd.plot,vsd.plot,rld.plot, 
          labels=c("counts","ntd","vst","rlog"),ncol=2,nrow=2)

df <- bind_rows(
  as_tibble(assay(ntd)[, 1:2]) %>% mutate(transformation = "ntd"),
  as_tibble(assay(vsd)[, 1:2]) %>% mutate(transformation = "vst"),
  as_tibble(assay(rld)[, 1:2]) %>% mutate(transformation = "rlog"))
colnames(df)[1:2] <- c("x", "y")  
lvls <- c("ntd", "vst", "rlog")
df$transformation <- factor(df$transformation, levels=lvls)
g = ggplot(df, aes(x = x, y = y)) + geom_hex(bins = 80) +
  coord_fixed() + facet_grid( . ~ transformation)  
print(g)

select <- order(rowMeans(counts(dds_bemisia.deseq,normalized=TRUE)),
                decreasing=TRUE)
df <- as.data.frame(colData(dds_bemisia.deseq)[,"sample"])

wss <- sapply(1:10, function(k) {
  kmeans(assay(ntd)[select, ], centers = k, nstart = 10, algorithm = "Lloyd", 
         iter.max = 1000)$tot.withinss
})


# 1. Heatmap avec ntd
pheatmap(assay(ntd)[select,],
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = 500)

# 2. Heatmap avec vsd
pheatmap(assay(vsd)[select,],
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = 500)

# 3. Heatmap avec rld
pheatmap(assay(rld)[select,],
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = 500)

# 4. Heatmap des distances entre échantillons
sampleDists <- dist(t(assay(vsd)))
sampleDistMatrix <- as.matrix(sampleDists)
rownames(sampleDistMatrix) <- paste(vsd$condition, vsd$type, sep = "-")
colnames(sampleDistMatrix) <- NULL
colors <- colorRampPalette(rev(brewer.pal(9, "Blues")))(255)

pheatmap(sampleDistMatrix,
         clustering_distance_rows = sampleDists,
         clustering_distance_cols = sampleDists,
         col = colors)

vst_df1 <- as.data.frame(t(assay(vsd)))
vst_df1$Treatment <- metadata$condition 
pca <- prcomp(vst_df1[,1:ncol(vst_df1)-1])

# Effectuer l'analyse PCA
pca_facto <- PCA(vst_df1[,1:ncol(vst_df1)-1], graph = FALSE)

# Préparer un PDF pour sauvegarde
#pdf("rquantif/Insect/PCA_FactoMineR_Bemisia_results.pdf", width = 10, 
#    height = 12)

## 1. Scree plot
print(fviz_screeplot(pca_facto, addlabels = TRUE, ylim = c(0, 70)))

## 2. Représentation des individus
print(fviz_pca_ind(pca_facto, axes = c(1, 2), repel = TRUE))

## 3. Cos2 des individus - Axe 1 & 2 côte à côte
p1 <- fviz_cos2(pca_facto, choice = "ind", axes = 1, 
                title = "Qualité de représentation (cos2) - Axe 1")
p2 <- fviz_cos2(pca_facto, choice = "ind", axes = 2, 
                title = "Qualité de représentation (cos2) - Axe 2")
grid.arrange(p1, p2, ncol = 2)

## 4. Contributions des individus - Axe 1 & 2 côte à côte
p3 <- fviz_contrib(pca_facto, choice = "ind", axes = 1, 
                   title = "Contribution des individus - Axe 1")
p4 <- fviz_contrib(pca_facto, choice = "ind", axes = 2, 
                   title = "Contribution des individus - Axe 2")
grid.arrange(p3, p4, ncol = 2)

## 5. Représentation colorée par cos2
print(fviz_pca_ind(pca_facto, repel = TRUE, col.ind = "cos2", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
                  axes = c(1, 2), title = "Individus - Colorés par cos2"))

## 6. Représentation colorée par contribution
print(fviz_pca_ind(pca_facto, repel = TRUE, col.ind = "contrib", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
                  axes = c(1, 2), 
                  title = "Individus - Colorés par contribution"))

## 7. Variables les plus contributrices (Top 5)
print(fviz_pca_var(pca_facto, col.var = "contrib", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
                  axes = c(1, 2), repel = TRUE, 
                  select.var = list(contrib = 5),
                  title = "Variables - Top 5 contributions"))

# 1. Extraire uniquement les données numériques
X <- vst_df1[, 1:(ncol(vst_df1) - 1)]
groupes <- as.factor(vst_df1$Treatment)

# 2. Analyse en composantes principales avec dudi.pca
acp <- dudi.pca(X, scannf = FALSE, nf = 5)

# 3. Analyse entre groupes (between-class analysis)
acp_btw <- ade4:::between(acp, groupes, scannf = FALSE, nf = 5)
## Warning in ade4:::between(acp, groupes, scannf = FALSE, nf = 5): To avoid some
## name conflicts, the 'between' function is now deprecated. Please use 'bca'
## instead
# 4. Visualisation
s.class(acp_btw$ls, fac = groupes, col = c("steelblue", "tomato", "darkgreen"),
        sub = "Projection des individus entre groupes")

# Fermer le PDF
#dev.off()

df_pca <- as.data.frame(pca$x)
df_pca$Treatment <- metadata$condition 
head(df_pca)
##            PC1       PC2        PC3        PC4        PC5        PC6        PC7
## B1L  -9.622603  8.372318   6.737333  -6.456848 -4.5302312  0.3506767 -1.7647136
## B2L -29.636426 16.607991   6.834900  16.831572 -3.6745249  6.4070886  3.2067236
## B3L  -3.074600  8.406587   6.217534  -5.359011 -5.2199654  5.5855708 -2.6144713
## B4L -17.018172 29.936036 -43.025295  -8.081412  0.9934767  0.1676285 -1.3743044
## B5L   2.007442  4.776853   6.697173 -15.295947 -3.3690963  2.0931569 -0.6045413
## B6L  -5.319688  3.588753   6.365667 -16.745114  0.9748201 -2.3033729  1.4273075
##             PC8        PC9       PC10       PC11       PC12       PC13
## B1L   2.7178591 -3.8773495  0.1253114  6.6824878 -6.4032795  3.4689407
## B2L -17.5877098 -0.9532186  2.8042817 -0.8407784 -2.9697205 -3.7173066
## B3L   3.9234850 -1.4715399  3.7273625 -0.2779724 -3.5807414 -0.6587047
## B4L  -0.1790356 -0.4498469 -0.1634209 -0.2257450  0.5833309  0.1258588
## B5L   0.5068259  0.8023655  4.3615720  0.8418124  0.6674006 -1.2734918
## B6L  -2.5098142  2.7211503 -0.6836151  0.7698852  4.7185288  0.8218754
##           PC14       PC15        PC16        PC17       PC18       PC19
## B1L  1.7719642 -3.8583507 -5.48144401 12.35935179  0.2284307 -3.9051852
## B2L  4.6811837  1.7428651  1.81360851  1.51111975  0.1132305  1.2936620
## B3L  2.3526782  3.0600301  1.05984369 -1.79731655 -7.2013276 -8.1976235
## B4L  0.1753681 -0.2892047  0.57234046 -0.09164923  0.1480173 -0.2248493
## B5L -0.3004929  3.4128826  0.05580584 -2.75565260 -5.5584517 -0.5662526
## B6L -0.1549251 -1.0318955 -2.21553319  1.02456116 -0.4574689  0.5829403
##           PC20        PC21       PC22       PC23       PC24       PC25
## B1L -3.1384856 -5.56399401  4.3615761  1.5615069  2.0116062  0.9619146
## B2L  0.3874994  0.99662672  0.5581961 -0.1719685 -0.3167858  2.1642652
## B3L -0.1790090  0.09762588 -1.8897633  1.9600774 -4.9050765 -5.1804468
## B4L  0.2696366  0.02129920  0.1195363  0.2910057  0.2349607 -0.1852221
## B5L -2.0883144  6.78569890 -4.3399900  1.3208957  2.7469715  6.4094688
## B6L -1.1047445  2.13684932 -0.4745441 -0.8941080 -7.4351700  5.3435865
##           PC26       PC27       PC28         PC29        PC30         PC31
## B1L -3.4389325 -1.9137561 -0.3044816 -0.029958763 -0.05905727 -0.883299690
## B2L -0.5935144  0.3343332  0.5145969 -0.358617912 -0.35927336 -0.028313642
## B3L  5.0910326  7.9512834 -2.7289836  2.670948012 -3.20071461  2.500198696
## B4L  0.1470147 -0.0435218  0.1299864 -0.005501495  0.10360085 -0.001939443
## B5L -3.2497100 -1.4452368  6.2382569  1.319649322  4.42738184  1.826461633
## B6L -0.4495837 -4.1874044  1.7310469  0.506036898 -4.77854552 -4.853435314
##            PC32       PC33       PC34        PC35       PC36         PC37
## B1L  2.40604687  0.7587713  0.5320164 -1.26931047 -1.8776706  1.102016029
## B2L  0.24479703  0.1357489 -0.3362142 -0.27099039  0.7251075  0.007766917
## B3L -0.43973811 -1.5806796  1.1873351 -0.19283515  1.6173611 -1.679893801
## B4L  0.04431119  0.2053629  0.1408394 -0.02939291 -0.2140555 -0.111152934
## B5L  3.20630581  6.0176623  2.3037523  0.13181247 -1.0159728  0.393453950
## B6L -2.33328934 -7.2270878  1.5133711 -0.04114272  3.5742818 -1.202760470
##            PC38        PC39          PC40   Treatment
## B1L  0.56042934 -0.44924226 -6.078659e-15   B_t1_Q21L
## B2L  0.06525671  0.80283563 -3.283058e-14   B_t1_Q21L
## B3L  0.21789691  1.06032219 -6.713336e-14   B_t1_Q21L
## B4L  0.05187198 -0.02639112 -4.415609e-14   B_t1_Q21L
## B5L -0.99207876 -3.08060959 -6.650903e-14   B_t1_Q21L
## B6L -2.88677371  4.71811159 -8.246433e-14 B_t1_Q21V_L
percentage <- round(pca$sdev^2 / sum(pca$sdev^2) * 100, 2)  
percentage <- paste( colnames(df_pca), "(",
                     paste( as.character(percentage), "%", ")", sep="") )
g = ggplot(df_pca, aes(PC1, PC2, color=Treatment)) + geom_point(size=2) +
  xlab(percentage[1]) + ylab(percentage[2]) + 
  theme(axis.text.x = element_text(family = "Times"),
        axis.title.x = element_text(family = "Times", face = "bold"), 
        axis.text.y = element_text(family = "Times"), 
        axis.title.y = element_text(family = "Times", face = "bold"), 
        legend.title = element_text(family = "Times", face = "bold"), 
        legend.text = element_text(family = "Times")) + 
  scale_colour_hue(name = "Condition") 
print(g)
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows

select_cond=c("B_t1_Q11L, B_t1_Q11V_L", "B_t1_Q21L, B_t1_Q21V_L", "B_t2_Q11L,
              B_t2_Q11V_L", "B_t2_Q21L, B_t2_Q21V_L", "B_t1_Q11V_L, 
              B_t2_Q11V_L", "B_t1_Q21V_L, B_t2_Q21V_L", "B_t1_Q11L, B_t2_Q11L",
              "B_t1_Q21L, B_t2_Q21L", "B_t1_Q11L, B_t1_Q21L", "B_t1_Q11V_L,
              B_t1_Q21V_L", "B_t2_Q11L, B_t2_Q21L", "B_t2_Q11V_L, B_t2_Q21V_L")
select_cond="B_t1_Q11L, B_t1_Q21L"
  #"B_t1_Q11L, B_t2_Q11L"
resultsNames(dds_bemisia.deseq) #verification
## [1] "Intercept"                          "condition_B_t1_Q11V_L_vs_B_t1_Q11L"
## [3] "condition_B_t1_Q21L_vs_B_t1_Q11L"   "condition_B_t1_Q21V_L_vs_B_t1_Q11L"
## [5] "condition_B_t2_Q11L_vs_B_t1_Q11L"   "condition_B_t2_Q11V_L_vs_B_t1_Q11L"
## [7] "condition_B_t2_Q21L_vs_B_t1_Q11L"   "condition_B_t2_Q21V_L_vs_B_t1_Q11L"
for (i in seq_along(select_cond)) {
  # Séparer les deux IDs par la virgule
  ids <- strsplit(select_cond[i], ",\\s*")[[1]]
  ID1 <- ids[1]
  ID2 <- ids[2]
  
  res.F <- results(dds_bemisia.deseq,contrast = c("condition", ID1, ID2))
  res.F$padj <- p.adjust(res.F$pvalue, method = "fdr") 
  #the padj is by FDR that is less restricted then bonfferoni(BH)
  res.F <- res.F[order(res.F$padj), ]
  sig_genes.res.F <- row.names(res.F)[which(abs(res.F$padj) < 0.05)]  
  #catch significant genes between the Insects
  file_name= paste0("rquantif/Insect/DESeq2_Results_res.I_", 
                    ID1, "_VS_", ID2, ".txt")
#  write.csv(res.F, file_name)
  
#  if (length(sig_genes.res.F) > 0){
#    write.csv(res.F[sig_genes.res.F,], file_name)
#  }
  # Ajouter une colonne pour log2FC et -log10(padj)
  res.F$log2FoldChange[is.na(res.F$log2FoldChange)] <- 0
  res.F$padj[is.na(res.F$padj)] <- 1
  res.F$negLogP <- -log10(res.F$padj)
  
  # Ajouter une colonne de statut
  res.F$status <- "Non significatif"
  res.F$status[res.F$padj < 0.05 & res.F$log2FoldChange > 0] <- "Sur-exprimé"
  res.F$status[res.F$padj < 0.05 & res.F$log2FoldChange < 0] <- "Sous-exprimé"
  
  # Définir des couleurs accessibles (daltonien-friendly)
  colors <- c(
    "Sur-exprimé" = "#D55E00",      # orange
    "Sous-exprimé" = "#0072B2",     # bleu clair
    "Non significatif" = "gray70"
  )
  
  # Tracer le volcano plot
  g <- ggplot(res.F, aes(x = log2FoldChange, y = negLogP, color = status)) +
    geom_point(alpha = 0.8, size = 1.5) +
    scale_color_manual(values = colors) +
    geom_vline(xintercept = 0, color = '#a2a2a2', 
                  alpha=0.7, linewidth = 0.2) +
    theme_light() +
    labs(title = paste(ID1, "vs", ID2),
         x = "log2(Fold Change)", y = "-log10(p-adj)") 
  print(g)
#  ggsave(paste("rquantif/Insect/DESeq2_Results_res.B_", ID1, '_', ID2, '.pdf'), 
#         plot = g)
}

vsd <- varianceStabilizingTransformation(dds_cytotype, blind = FALSE)
## using 'avgTxLength' from assays(dds), correcting for library size
## -- note: fitType='parametric', but the dispersion trend was not well captured by the
##    function: y = a/x + b, and a local regression fit was automatically substituted.
##    specify fitType='local' or 'mean' to avoid this message next time.
rld <- rlog(dds_cytotype, blind=FALSE)
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## using 'avgTxLength' from assays(dds), correcting for library size
## -- note: fitType='parametric', but the dispersion trend was not well captured by the
##    function: y = a/x + b, and a local regression fit was automatically substituted.
##    specify fitType='local' or 'mean' to avoid this message next time.
head(assay(vsd), 3)
##                                          B1L      B2L      B3L      B4L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 6.287347 6.392612 6.489676 7.120189
## lcl|NC_018618.1_cds_PAQ_RS00835_147 7.103016 6.598571 6.984696 7.464447
## lcl|NC_018618.1_cds_PAQ_RS01200_210 4.386003 4.263904 4.358143 4.920503
##                                          B5L      B6L      B7L      B8L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 6.739285 6.407870 6.644427 6.422697
## lcl|NC_018618.1_cds_PAQ_RS00835_147 6.982641 6.971050 6.972432 6.831850
## lcl|NC_018618.1_cds_PAQ_RS01200_210 4.388178 4.313165 4.553925 4.596858
##                                          B9L     B10L     B11L     B12L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 6.199389 6.414331 6.348956 5.578151
## lcl|NC_018618.1_cds_PAQ_RS00835_147 7.272238 6.964890 5.519293 6.079140
## lcl|NC_018618.1_cds_PAQ_RS01200_210 4.498927 4.226584 4.303566 3.873117
##                                         B13L     B14L     B15L     B16L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 5.512648 5.704905 4.687949 4.888984
## lcl|NC_018618.1_cds_PAQ_RS00835_147 5.512756 6.873190 6.668866 5.322777
## lcl|NC_018618.1_cds_PAQ_RS01200_210 3.465082 3.465082 3.465082 3.833159
##                                         B17L     B18L     B19L     B20L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 5.607340 5.131293 6.746970 5.017174
## lcl|NC_018618.1_cds_PAQ_RS00835_147 6.423354 6.079092 5.042749 6.926972
## lcl|NC_018618.1_cds_PAQ_RS01200_210 3.825558 3.465082 4.484604 3.465082
##                                         B21L     B22L     B23L     B24L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 6.068495 5.393669 5.831179 6.573595
## lcl|NC_018618.1_cds_PAQ_RS00835_147 6.140549 6.110859 6.274028 6.603973
## lcl|NC_018618.1_cds_PAQ_RS01200_210 4.069937 3.949903 3.932803 4.040256
##                                         B25L     B26L     B27L     B28L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 6.262885 6.166653 6.600732 6.224885
## lcl|NC_018618.1_cds_PAQ_RS00835_147 6.853961 6.673648 6.717867 6.961723
## lcl|NC_018618.1_cds_PAQ_RS01200_210 4.156300 3.940989 4.847054 4.121710
##                                         B29L     B30L     B31L     B32L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 6.569086 6.560886 5.361408 6.051598
## lcl|NC_018618.1_cds_PAQ_RS00835_147 6.757587 6.835288 6.778218 6.621534
## lcl|NC_018618.1_cds_PAQ_RS01200_210 4.063468 4.078924 4.156488 3.888593
##                                         B33L     B34L     B35L     B36L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 5.892676 5.903351 6.170229 5.268310
## lcl|NC_018618.1_cds_PAQ_RS00835_147 6.530845 6.885144 6.040360 6.359459
## lcl|NC_018618.1_cds_PAQ_RS01200_210 4.106723 4.389276 4.162538 3.465082
##                                         B37L     B38L     B39L     B40L
## lcl|NC_018618.1_cds_PAQ_RS00660_119 5.587798 6.002338 6.113905 6.322908
## lcl|NC_018618.1_cds_PAQ_RS00835_147 6.641188 7.026771 7.124702 6.986538
## lcl|NC_018618.1_cds_PAQ_RS01200_210 4.090904 3.951401 4.019345 4.048328
ntd <- normTransform(dds_cytotype)
## using 'avgTxLength' from assays(dds), correcting for library size
count.plot <- meanSdPlot(assay(dds_cytotype))$gg

ntd.plot <- meanSdPlot(assay(ntd))$gg

vsd.plot <- meanSdPlot(assay(vsd))$gg

rld.plot <- meanSdPlot(assay(rld))$gg

ggarrange(count.plot,ntd.plot,vsd.plot,rld.plot, 
          labels=c("counts","ntd","vst","rlog"),ncol=2,nrow=2)

df <- bind_rows(
  as_tibble(assay(ntd)[, 1:2]) %>% mutate(transformation = "ntd"),
  as_tibble(assay(vsd)[, 1:2]) %>% mutate(transformation = "vst"),
  as_tibble(assay(rld)[, 1:2]) %>% mutate(transformation = "rlog"))
colnames(df)[1:2] <- c("x", "y")  
lvls <- c("ntd", "vst", "rlog")
df$transformation <- factor(df$transformation, levels=lvls)
g = ggplot(df, aes(x = x, y = y)) + geom_hex(bins = 80) +
  coord_fixed() + facet_grid( . ~ transformation)  
print(g)

select <- order(rowMeans(counts(dds_cytotype.deseq,normalized=TRUE)),
                decreasing=TRUE)
df <- as.data.frame(colData(dds_cytotype.deseq)[,"sample"])

subset_data_ntd <- assay(ntd)[sample(select, size = 1000, replace = TRUE), ]
subset_data_vsd <- assay(vsd)[sample(select, size = 1000, replace = TRUE), ]
subset_data_rld <- assay(rld)[sample(select, size = 1000, replace = TRUE), ]

data_mat_ntd <- subset_data_ntd
data_mat_ntd <- unique(data_mat_ntd)  # enlève les doublons exacts
data_mat_ntd <- jitter(data_mat_ntd)

data_mat_vsd <- subset_data_vsd
data_mat_vsd <- unique(data_mat_vsd)  # enlève les doublons exacts
data_mat_vsd <- jitter(data_mat_vsd)

data_mat_rld <- subset_data_rld
data_mat_rld <- unique(data_mat_rld)  # enlève les doublons exacts
data_mat_rld <- jitter(data_mat_rld)

k_val_ntd <- min(500, nrow(unique(subset_data_ntd)))
k_val_vsd <- min(500, nrow(unique(subset_data_vsd)))
k_val_rld <- min(500, nrow(unique(subset_data_rld)))

wss <- sapply(1:k_val_ntd, function(k) {
  kmeans(data_mat_ntd, centers = k, nstart = 10, algorithm = "Lloyd", 
         iter.max = 1000)$tot.withinss
})
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
## Warning: classe vide : essayez un jeu de centres meilleur
sampleDists <- dist(t(assay(vsd)))
sampleDistMatrix <- as.matrix(sampleDists)
rownames(sampleDistMatrix) <- paste(vsd$condition, vsd$type, sep = "-")
colnames(sampleDistMatrix) <- NULL
colors <- colorRampPalette(rev(brewer.pal(9, "Blues")))(255)

# 1. Heatmap avec ntd
pheatmap(subset_data_ntd,
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = k_val_ntd)

# 2. Heatmap avec vsd
pheatmap(subset_data_vsd,
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = k_val_vsd)

# 3. Heatmap avec rld
pheatmap(subset_data_rld,
         cluster_rows = TRUE, show_rownames = FALSE,
         cluster_cols = TRUE, show_colnames = FALSE,
         kmeans_k = k_val_rld)

# 4. Heatmap des distances entre échantillons
pheatmap(sampleDistMatrix,
         clustering_distance_rows = sampleDists,
         clustering_distance_cols = sampleDists,
         col = colors)

vst_df1 <- as.data.frame(t(assay(vsd)))
vst_df1$Treatment <- metadata$condition 
pca <- prcomp(vst_df1[,1:ncol(vst_df1)-1])

# Préparer un PDF pour sauvegarde
#pdf("rquantif/Insect/PCA_FactoMineR_Cytotype_results.pdf", width = 10,
#    height = 12)

## 1. Scree plot
print(fviz_screeplot(pca_facto, addlabels = TRUE, ylim = c(0, 70)))

## 2. Représentation des individus
print(fviz_pca_ind(pca_facto, axes = c(1, 2), repel = TRUE))

## 3. Cos2 des individus - Axe 1 & 2 côte à côte
p1 <- fviz_cos2(pca_facto, choice = "ind", axes = 1,
                title = "Qualité de représentation (cos2) - Axe 1")
p2 <- fviz_cos2(pca_facto, choice = "ind", axes = 2,
                title = "Qualité de représentation (cos2) - Axe 2")
grid.arrange(p1, p2, ncol = 2)

## 4. Contributions des individus - Axe 1 & 2 côte à côte
p3 <- fviz_contrib(pca_facto, choice = "ind", axes = 1,
                   title = "Contribution des individus - Axe 1")
p4 <- fviz_contrib(pca_facto, choice = "ind", axes = 2, 
                   title = "Contribution des individus - Axe 2")
grid.arrange(p3, p4, ncol = 2)

## 5. Représentation colorée par cos2
print(fviz_pca_ind(pca_facto, repel = TRUE, col.ind = "cos2", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
                  axes = c(1, 2), title = "Individus - Colorés par cos2"))

## 6. Représentation colorée par contribution
print(fviz_pca_ind(pca_facto, repel = TRUE, col.ind = "contrib", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
                  axes = c(1, 2), 
                  title = "Individus - Colorés par contribution"))

## 7. Variables les plus contributrices (Top 5)
print(fviz_pca_var(pca_facto, col.var = "contrib", 
                  gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
                  axes = c(1, 2), repel = TRUE, 
                  select.var = list(contrib = 5),
                  title = "Variables - Top 5 contributions"))

# 1. Extraire uniquement les données numériques
X <- vst_df1[, 1:(ncol(vst_df1) - 1)]
groupes <- as.factor(vst_df1$Treatment)

# 2. Analyse en composantes principales avec dudi.pca
acp <- dudi.pca(X, scannf = FALSE, nf = 5)

# 3. Analyse entre groupes (between-class analysis)
acp_btw <- ade4:::between(acp, groupes, scannf = FALSE, nf = 5)
## Warning in ade4:::between(acp, groupes, scannf = FALSE, nf = 5): To avoid some
## name conflicts, the 'between' function is now deprecated. Please use 'bca'
## instead
# 4. Visualisation
s.class(acp_btw$ls, fac = groupes, col = c("steelblue", "tomato", "darkgreen"),
        sub = "Projection des individus entre groupes")

# Fermer le PDF
#dev.off()

df_pca <- as.data.frame(pca$x)
df_pca$Treatment <- metadata$condition 
head(df_pca)
##           PC1          PC2         PC3        PC4       PC5         PC6
## B1L -4.286879 -0.621567454  0.02980711 -0.3918758 0.6728402 -0.53579207
## B2L -3.079178  0.003234504 -0.48040128 -0.2760292 0.5157141 -0.40830429
## B3L -6.521770 -1.663057933 -0.37150399 -0.6249179 1.1370346  0.31549496
## B4L -6.773662 -2.627761352 -1.01786778 -1.0667494 4.2329095 -1.25127812
## B5L -6.589906 -0.179042366 -0.13681845 -0.3737296 1.1848833 -0.00201096
## B6L -6.621218 -0.847945685 -0.50144171 -0.3358337 1.0838811 -0.07200709
##           PC7        PC8        PC9       PC10       PC11        PC12
## B1L 0.6193909 -0.1015177 0.31364931 -1.4064133  0.2494543  0.36998920
## B2L 1.5141679  0.3899437 0.15180587 -0.8664044  0.4296221 -0.72320237
## B3L 1.0379321 -0.3899539 0.04533722 -1.0854331 -0.9664986 -0.03354986
## B4L 0.1701296 -1.8294168 0.73471968  5.6840085  3.1451596 -1.67704916
## B5L 1.2624603 -0.1361278 0.11873572 -1.2641458 -0.3338287  0.06646135
## B6L 1.0978624 -0.1181670 0.28887858 -1.1717623 -0.6240227 -0.05154107
##            PC13        PC14        PC15       PC16       PC17        PC18
## B1L -0.32230363  0.47742489 -0.40177709  0.2567987  0.7509373 -0.48166735
## B2L -0.06923783  2.43519295 -0.98145064  0.3708906  0.9168041 -0.30599252
## B3L -0.29468039 -0.83936767 -0.34117863  0.2923987  0.3164200 -0.09002289
## B4L -0.22199746  0.12494151 -0.56457478 -0.3012580 -0.4747489  0.00943062
## B5L -0.09885235  0.04152965  0.01785049  0.1288856  0.1749938 -0.16114479
## B6L -0.37967874 -0.63281227 -0.11363636  0.4277944  0.6802721 -0.43675076
##           PC19        PC20        PC21       PC22        PC23       PC24
## B1L -0.2273164 -0.12395850 -0.09747282 -0.8991981  0.05885335  0.8374187
## B2L -1.7203745  2.11534567 -0.40575211  0.8245344 -0.52242805 -1.3532086
## B3L -0.2306214 -0.48365751  0.01132052 -0.1493762  0.75425900  0.1866568
## B4L -0.0219422 -0.07391869  0.06916941  0.1686847 -0.03946347  0.2462018
## B5L  0.1463607 -0.51100339  0.18702124 -0.2785667  0.31840862  0.5556325
## B6L  0.2120679 -0.23522690  0.60149661 -0.1535121  0.18611420  0.3943821
##            PC25        PC26        PC27       PC28         PC29        PC30
## B1L  0.43764618  1.72803120 -1.32199419 -0.3306104  0.186083892  1.13368476
## B2L -0.83597738 -0.74097853 -1.25518585  0.4007908  0.006210601 -0.01279870
## B3L -0.38413382 -0.59003976  0.01613758 -0.8888158  1.310776015 -0.05191703
## B4L  0.48535392  0.02156591 -0.14269379 -0.1418867 -0.143653880  0.01662797
## B5L  0.06535619 -0.03429883 -0.06948546  0.4586843  0.029649364  0.20310952
## B6L  0.25360590 -0.25478655  0.37642665  1.1108484 -0.483196934  0.89746372
##            PC31        PC32        PC33        PC34        PC35        PC36
## B1L  0.86460492 -0.94583370 -0.25886647 -0.18284268 -0.27365076 -0.73574050
## B2L  0.20403218  0.10291826  0.29341570 -0.03872676  0.05078148  0.23649435
## B3L -0.31993694  0.43325344  1.22282705  0.35712194 -0.93766684 -0.05842936
## B4L -0.03879686  0.05118106  0.04778272  0.07751079 -0.04844731  0.02076011
## B5L  1.01081912  1.40571765 -1.34378000  0.28307851 -0.35953529  1.14307037
## B6L -0.88593544 -0.45678064  0.78174690 -0.47777716  0.20167243  0.54374282
##            PC37         PC38        PC39         PC40   Treatment
## B1L  0.08816968  0.024283480  0.03450363 4.951822e-15   B_t1_Q21L
## B2L -0.03288484  0.046098353 -0.10340659 4.392591e-15   B_t1_Q21L
## B3L  0.65698135 -0.167108115  0.62987640 4.032202e-15   B_t1_Q21L
## B4L -0.04570916 -0.008746499  0.02989627 4.224973e-15   B_t1_Q21L
## B5L -0.24608081  0.054735067  0.25142840 4.781765e-15   B_t1_Q21L
## B6L -1.03034398 -0.847823064  0.08995165 4.488760e-15 B_t1_Q21V_L
percentage <- round(pca$sdev^2 / sum(pca$sdev^2) * 100, 2)  
percentage <- paste( colnames(df_pca), "(", 
                     paste( as.character(percentage), "%", ")", sep="") )
g = ggplot(df_pca, aes(PC1, PC2, color=Treatment)) + geom_point(size=2) + 
  xlab(percentage[1]) + ylab(percentage[2]) + 
  theme(axis.text.x = element_text(family = "Times"), 
        axis.title.x = element_text(family = "Times", face = "bold"), 
        axis.text.y = element_text(family = "Times"), 
        axis.title.y = element_text(family = "Times", face = "bold"),
        legend.title = element_text(family = "Times", face = "bold"),
        legend.text = element_text(family = "Times")) + 
  scale_colour_hue(name = "Condition") 
print(g)
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## famille de police introuvable dans la base de données des polices Windows

select_cond=c("B_t1_Q11L, B_t1_Q11V_L", "B_t1_Q21L, B_t1_Q21V_L", "B_t2_Q11L, 
              B_t2_Q11V_L", "B_t2_Q21L, B_t2_Q21V_L", "B_t1_Q11V_L, 
              B_t2_Q11V_L", "B_t1_Q21V_L, B_t2_Q21V_L", "B_t1_Q11L, B_t2_Q11L",
              "B_t1_Q21L, B_t2_Q21L", "B_t1_Q11L, B_t1_Q21L", "B_t1_Q11V_L,
              B_t1_Q21V_L", "B_t2_Q11L, B_t2_Q21L", "B_t2_Q11V_L, B_t2_Q21V_L")

for (i in seq_along(select_cond)) {
  # Séparer les deux IDs par la virgule
  ids <- strsplit(select_cond[i], ",\\s*")[[1]]
  ID1 <- ids[1]
  ID2 <- ids[2]

  res.F <- results(dds_cytotype.deseq ,contrast = c("condition", ID1, ID2))
  res.F$padj <- p.adjust(res.F$pvalue, method = "fdr") 
  #the padj is by FDR that is less restricted then bonfferoni(BH)
  res.F <- res.F[order(res.F$padj), ]
  sig_genes.res.F <- row.names(res.F)[which(abs(res.F$padj) < 0.05)]  
  #catch significant genes between the Insects
  file_name= paste0("rquantif/Insect/DESeq2_Results_res.F.C_", 
                    ID1, "_VS_", ID2, ".txt")
  write.csv(res.F, file_name)
  volcano_name= paste0("volcano_C_", ID1, "_VS_", ID2, ".pdf")
  if (length(sig_genes.res.F) > 0){
    write.csv(res.F[sig_genes.res.F,], file_name)
  }
  # Ajouter une colonne pour log2FC et -log10(padj)
  res.F$log2FoldChange[is.na(res.F$log2FoldChange)] <- 0
  res.F$padj[is.na(res.F$padj)] <- 1
  res.F$negLogP <- -log10(res.F$padj)
  
  # Ajouter une colonne de statut
  res.F$status <- "Non significatif"
  res.F$status[res.F$padj < 0.05 & res.F$log2FoldChange > 0] <- "Sur-exprimé"
  res.F$status[res.F$padj < 0.05 & res.F$log2FoldChange < 0] <- "Sous-exprimé"
  
  # Définir des couleurs accessibles (daltonien-friendly)
  colors <- c(
    "Sur-exprimé" = "#D55E00",      # orange
    "Sous-exprimé" = "#0072B2",     # bleu clair
    "Non significatif" = "gray70"
  )
  
  # Tracer le volcano plot
  g <- ggplot(res.F, aes(x = log2FoldChange, y = negLogP, color = status)) +
    geom_point(alpha = 0.8, size = 1.5) +
    scale_color_manual(values = colors) +
    geom_vline(xintercept = 0, color = '#a2a2a2', 
                  alpha=0.7, linewidth = 0.2) +
    theme_light() +
    labs(title = paste(ID1, "vs", ID2),
         x = "log2(Fold Change)", y = "-log10(p-adj)") 
  print(g)
#  ggsave(paste("rquantif/Insect/DESeq2_Results_res.C_", ID1, '_', ID2, '.pdf'),
#         plot = g)
}

2 TopGO analysis

2.1 Plant

2.1.1 Import des données pour l’analyse TopGO sur les échantillons issus des plantes

# Annotations GO (InterProScan)
interproscan <- read.delim('TopGO/Plant/plant_GO_sorted.txt', 
   header = FALSE, sep = '\t')
head(interproscan)
##                                                       V1         V2
## 1 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338_orf235147 GO:0003677
## 2 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338_orf235147 GO:0003824
## 3 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338_orf235147 GO:0004518
## 4 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338_orf235147 GO:0016788
## 5 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338_orf739763 GO:0003677
## 6 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338_orf739763 GO:0003824
interproscan$V1 <- vapply(interproscan$V1, 
                          function(x) gsub('_orf[0-9]+', '', x), character(1))
#take out the orf part

interproscan <- as.data.frame(interproscan)
head(interproscan)
##                                             V1         V2
## 1 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338 GO:0003677
## 2 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338 GO:0003824
## 3 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338 GO:0004518
## 4 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338 GO:0016788
## 5 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338 GO:0003677
## 6 lcl|CAKKNF020000001.1_cds_CAH0746830.1_16338 GO:0003824
# Vérifier la structure des fichiers
if (ncol(interproscan) < 2) 
  stop('Erreur : Le fichier interproscan semble mal formaté.')

# Définir la liste des conditions d’intérêt
select_cond <- c(
  "P_t1_Q11L, P_t1_Q11V_L",
  "P_t1_Q21L, P_t1_Q21V_L",
  "P_t2_Q11L, P_t2_Q11V_L",
  "P_t2_Q21L, P_t2_Q21V_L",
  "P_t1_Q11V_L, P_t2_Q11V_L",
  "P_t1_Q21V_L, P_t2_Q21V_L",
  "P_t1_Q11L, P_t2_Q11L",
  "P_t1_Q21L, P_t2_Q21L",
  "P_t1_Q11L, P_t1_Q21L",
  "P_t1_Q11V_L, P_t1_Q21V_L",
  "P_t2_Q11L, P_t2_Q21L",
  "P_t2_Q11V_L, P_t2_Q21V_L"
)

# Lire les lignes du fichier contenant les chemins et infos 
lines_raw <- readLines("TopGO/Plant/liste_deseq.txt")
## Warning in readLines("TopGO/Plant/liste_deseq.txt"): ligne finale incomplète
## trouvée dans 'TopGO/Plant/liste_deseq.txt'
# Initialiser une liste de résultats 
chemins_trouves <- data.frame(ID1 = character(),
                              ID2 = character(),
                              chemin = character(),
                              info = character(),
                              stringsAsFactors = FALSE)

# Recherche des lignes correspondantes à chaque couple
for (cond in select_cond) {
  ids <- str_split(cond, ",\\s*")[[1]]
  id1 <- ids[1]
  id2 <- ids[2]
  
  # Match la ligne contenant les deux identifiants dans le nom du fichier
  match_lines <- lines_raw[str_detect(lines_raw, fixed(id1)) & 
                             str_detect(lines_raw, fixed(id2))]
  
  for (line in match_lines) {
    # Séparer le chemin et l'info
    parts <- str_split(line, ",\\s*")[[1]]
    chemin <- parts[1]
    info <- ifelse(length(parts) > 1, parts[2], NA)

    if (!is.na(chemin) && file.exists(chemin)) {
      chemins_trouves <- rbind(
        chemins_trouves,
        data.frame(ID1 = id1, ID2 = id2, chemin = chemin, info = info, 
                   stringsAsFactors = FALSE)
      )
    } else {
      warning(paste("Fichier introuvable ou chemin invalide:", chemin))
    }
  }
}

# Importer et annoter les tableaux
list_tables <- list()

for (i in 1:nrow(chemins_trouves)) {
  path <- chemins_trouves$chemin[i]
  id_label <- paste(chemins_trouves$ID1[i], chemins_trouves$ID2[i], 
                    sep = "_VS_")
  info_val <- chemins_trouves$info[i]

  df <- tryCatch({
    read_delim(path, delim = ",", show_col_types = FALSE)
  }, error = function(e) {
    warning(paste("Erreur lors de l'import:", path))
    return(NULL)
  })

  if (!is.null(df)) {
    df$ID <- id_label
    df$Info <- info_val
    df_2 <- subset(df,padj < 0.05 & abs(log2FoldChange) > 1 & padj != 0) 
    #use subset to filter dataframes by columns
    list_tables[[length(list_tables) + 1]] <- df_2
  }
}
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## • `` -> `...1`
# Fusionner tous les tableaux 
table_fusionnee <- bind_rows(list_tables)
colnames(table_fusionnee)[1] <- "gene_id"

# Aperçu ou sauvegarde
print(head(table_fusionnee))
## # A tibble: 6 × 9
##   gene_id     baseMean log2FoldChange lfcSE   stat   pvalue     padj ID    Info 
##   <chr>          <dbl>          <dbl> <dbl>  <dbl>    <dbl>    <dbl> <chr> <chr>
## 1 lcl|NC_090…    105.           -21.7  2.01 -10.8  4.38e-27 1.56e-22 P_t1… Plant
## 2 lcl|NC_090…     60.1           22.4  2.18  10.3  9.43e-25 1.69e-20 P_t1… Plant
## 3 lcl|NC_090…     51.3           23.3  2.44   9.53 1.60e-21 1.91e-17 P_t1… Plant
## 4 lcl|NC_090…     26.6          -18.9  2.10  -8.97 2.96e-19 2.64e-15 P_t1… Plant
## 5 lcl|NC_090…    196.            26.4  2.97   8.91 5.03e-19 3.59e-15 P_t1… Plant
## 6 lcl|NC_090…     23.2          -19.8  2.36  -8.39 5.02e-17 2.56e-13 P_t1… Plant
#write_csv(table_fusionnee, "TopGO/Plant/table_fusionnee.csv")


# Vérifier le nombre de gènes significatifs
cat('Nombre de gènes différentiellement exprimés :',
    nrow(table_fusionnee), '\\n')
## Nombre de gènes différentiellement exprimés : 6316 \n
# Renommer les colonnes du fichier interproscan
colnames(interproscan)[1:2] <- c('GeneID', 'GO')

# Supprimer les lignes sans GO
interproscan <- interproscan[!is.na(interproscan$GO) & interproscan$GO != '', ]

# Associer chaque gène à ses termes GO
gene2GO <- split(interproscan$GO, interproscan$GeneID)
gene2GO <- lapply(gene2GO, function(x) unique(unlist(strsplit(x, ';'))))

# Définir l'univers des gènes et la liste binaire des gènes significatifs
geneUniverse <- names(gene2GO)

ont_list=c("BP", "MF", "CC")
#BP = Biological Process, MF = Molecular Function, CC = Cellular Component

2.1.2 Formalisations des données, tests et représentations graphiques

for (i in unique(table_fusionnee$ID)){
  table_trimmed = subset(table_fusionnee, ID == i)
  up_table = subset(table_trimmed, log2FoldChange >= 1)
  down_table = subset(table_trimmed, log2FoldChange <= -1)
  geneList_up <- factor(as.integer(geneUniverse %in% up_table$gene_id), 
                        levels = c(0, 1))
  geneList_down <- factor(as.integer(geneUniverse %in% down_table$gene_id),
                          levels = c(0, 1))
  
  for (y in ont_list){
    condition = i
    orga = table_fusionnee$Info[i]
    ontology = y
    
    table(geneList_up)
    #check you have significant genes inside the geneUniverse
    names(geneList_up) <- geneUniverse
    table(geneList_down)
    #check you have significant genes inside the geneUniverse
    names(geneList_down) <- geneUniverse
    
    # Initialiser l’objet topGO
    GOdata_up <- new('topGOdata',
        description = "Enrichment analysis",
        ontology = y, 
        allGenes = geneList_up,
        annot = annFUN.gene2GO,
        geneSelectionFun = function(x) x == 1,
        gene2GO = gene2GO,
        nodeSize = 5)
    GOdata_down <- new('topGOdata',
        description = "Enrichment analysis",
        ontology = y, 
        allGenes = geneList_down,
        annot = annFUN.gene2GO,
        geneSelectionFun = function(x) x == 1,
        gene2GO = gene2GO,
        nodeSize = 5)
    
    # TEST D’ENRICHISSEMENT GO 
    resultFisher_wheight01 <- runTest(GOdata_up, algorithm = 'weight01',
                                      statistic = 'fisher')
    pValueFisher_wheight01 <- score(resultFisher_wheight01)
    
    resultFisher_classic <- runTest(GOdata_up, algorithm = 'classic',
                                    statistic = 'fisher')
    pValueFisher_classic <- score(resultFisher_classic)
    
    # Obtenir les résultats
    GOtable_up <- GenTable(GOdata_up, p.value = resultFisher_wheight01,
                           orderBy = 'p.value', topNodes = 20)
    
    # Sauvegarder les résultats
#    write.csv(GOtable_up, paste('TopGO/Plant/TopGO_Up/topGO_results_up_', i, 
#                                '_', y, '.csv'),
#              row.names = FALSE)
    
    allRes <- GenTable(GOdata_up, classic = resultFisher_classic, 
                       weight = resultFisher_wheight01, orderBy = "weight", 
                       ranksOf = "weight", topNodes = 20)
    knitr::kable(allRes)
#    GO.res <- 
    showSigOfNodes(GOdata_up, score(resultFisher_classic), 
                             firstSigNodes = 20, useInfo = 'all')

    resultFisher_wheight01 <- runTest(GOdata_down, algorithm = 'weight01',
                                      statistic = 'fisher')
    pValueFisher_wheight01 <- score(resultFisher_wheight01)
    
    resultFisher_classic <- runTest(GOdata_down, algorithm = 'classic', 
                                    statistic = 'fisher')
    pValueFisher_classic <- score(resultFisher_classic)
    
    # Obtenir les résultats
    GOtable_down <- GenTable(GOdata_up, p.value = resultFisher_wheight01, 
                             orderBy = 'p.value', topNodes = 20)
    
    # Sauvegarder les résultats
#    write.csv(GOtable_down, paste('TopGO/Plant/TopGO_Down/topGO_results_down_', 
#                                  i, '_', y, '.csv'), row.names = FALSE)
    
    # VISUALISATION 
    GOtable_up_filt <- GOtable_up[as.numeric(GOtable_up$p.value) < 0.05, ]
    GOtable_down_filt <- GOtable_down[as.numeric(GOtable_down$p.value) < 0.05, ]
    # S'assurer que p.value est bien numérique
    GOtable_up_filt$p.value <- as.numeric(GOtable_up_filt$p.value)
    GOtable_down_filt$p.value <- as.numeric(GOtable_down_filt$p.value)
    
    # Ajouter une étiquette pour distinguer Up et Down
    GOtable_up_filt$Direction <- "Up"
    GOtable_down_filt$Direction <- "Down"
    
    # Ajouter la colonne inv_pvalue
    GOtable_up_filt$inv_pvalue <- GOtable_up_filt$p.value         
    # pour les up → identique
    GOtable_down_filt$inv_pvalue <- 1 / GOtable_down_filt$p.value 
    # pour les down → inversée
    
    # Fusionner les deux
    GOtable_filt <- rbind(GOtable_up_filt, GOtable_down_filt)

    # Tracé avec ggplot
    g <- ggplot(GOtable_filt, aes(x = reorder(Term, 
                                              -log10(as.numeric(inv_pvalue))), 
       y = -log10(as.numeric(inv_pvalue)))) +
       geom_bar(stat = 'identity', fill = '#00a3a6') +
       geom_hline(yintercept = -log10(0.05), color = 'red', linetype = 'dashed', 
                  linewidth = 1) +
       geom_hline(yintercept = -log10(1/0.05), color = 'red', 
                  linetype = 'dashed', 
                  linewidth = 1) +
       geom_hline(yintercept = 0, color = 'white', linewidth = 0.5) +
       coord_flip() +
       labs(x = 'Termes GO', y = '-log10[p-value]', 
            title = i)
    print(g)
#    ggsave(paste("TopGO/Plant/topGO_results_", i, '_', y, '.pdf'), plot = g)
    allRes <- GenTable(GOdata_down, classic = resultFisher_classic, 
                       weight = resultFisher_wheight01, orderBy = "weight", 
                       ranksOf = "weight", topNodes = 20)
    knitr::kable(allRes)
#    GO.res <- 
    showSigOfNodes(GOdata_down,  topGO::score(resultFisher_classic), 
                             firstSigNodes = 20, useInfo = 'all')
  }
}
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 473 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  9 nodes to be scored    (6 eliminated genes)
## 
##   Level 10:  21 nodes to be scored   (387 eliminated genes)
## 
##   Level 9:   34 nodes to be scored   (551 eliminated genes)
## 
##   Level 8:   56 nodes to be scored   (1177 eliminated genes)
## 
##   Level 7:   68 nodes to be scored   (4284 eliminated genes)
## 
##   Level 6:   78 nodes to be scored   (7383 eliminated genes)
## 
##   Level 5:   84 nodes to be scored   (11270 eliminated genes)
## 
##   Level 4:   67 nodes to be scored   (15889 eliminated genes)
## 
##   Level 3:   39 nodes to be scored   (21158 eliminated genes)
## 
##   Level 2:   11 nodes to be scored   (23538 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (24073 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 473 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 305 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  5 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  11 nodes to be scored   (179 eliminated genes)
## 
##   Level 9:   20 nodes to be scored   (321 eliminated genes)
## 
##   Level 8:   31 nodes to be scored   (820 eliminated genes)
## 
##   Level 7:   39 nodes to be scored   (3985 eliminated genes)
## 
##   Level 6:   48 nodes to be scored   (6348 eliminated genes)
## 
##   Level 5:   60 nodes to be scored   (12015 eliminated genes)
## 
##   Level 4:   51 nodes to be scored   (14660 eliminated genes)
## 
##   Level 3:   28 nodes to be scored   (20475 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (23154 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23759 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 305 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 308 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   11 nodes to be scored   (60 eliminated genes)
## 
##   Level 8:   26 nodes to be scored   (138 eliminated genes)
## 
##   Level 7:   40 nodes to be scored   (5958 eliminated genes)
## 
##   Level 6:   57 nodes to be scored   (9777 eliminated genes)
## 
##   Level 5:   69 nodes to be scored   (11542 eliminated genes)
## 
##   Level 4:   64 nodes to be scored   (15445 eliminated genes)
## 
##   Level 3:   23 nodes to be scored   (23808 eliminated genes)
## 
##   Level 2:   12 nodes to be scored   (26994 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34273 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 308 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 229 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   5 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   15 nodes to be scored   (0 eliminated genes)
## 
##   Level 7:   24 nodes to be scored   (5093 eliminated genes)
## 
##   Level 6:   44 nodes to be scored   (8563 eliminated genes)
## 
##   Level 5:   54 nodes to be scored   (10699 eliminated genes)
## 
##   Level 4:   51 nodes to be scored   (14105 eliminated genes)
## 
##   Level 3:   24 nodes to be scored   (22459 eliminated genes)
## 
##   Level 2:   11 nodes to be scored   (25933 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34940 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 229 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 68 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   7 nodes to be scored    (14 eliminated genes)
## 
##   Level 7:   12 nodes to be scored   (14 eliminated genes)
## 
##   Level 6:   10 nodes to be scored   (253 eliminated genes)
## 
##   Level 5:   11 nodes to be scored   (1162 eliminated genes)
## 
##   Level 4:   13 nodes to be scored   (2378 eliminated genes)
## 
##   Level 3:   10 nodes to be scored   (4079 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (5195 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9658 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 68 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 31 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   4 nodes to be scored    (27 eliminated genes)
## 
##   Level 6:   5 nodes to be scored    (421 eliminated genes)
## 
##   Level 5:   2 nodes to be scored    (1139 eliminated genes)
## 
##   Level 4:   6 nodes to be scored    (2998 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (3907 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4822 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9000 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 31 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 219 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 14:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  3 nodes to be scored    (21 eliminated genes)
## 
##   Level 11:  7 nodes to be scored    (21 eliminated genes)
## 
##   Level 10:  8 nodes to be scored    (62 eliminated genes)
## 
##   Level 9:   14 nodes to be scored   (234 eliminated genes)
## 
##   Level 8:   18 nodes to be scored   (468 eliminated genes)
## 
##   Level 7:   27 nodes to be scored   (3943 eliminated genes)
## 
##   Level 6:   32 nodes to be scored   (5084 eliminated genes)
## 
##   Level 5:   42 nodes to be scored   (10059 eliminated genes)
## 
##   Level 4:   34 nodes to be scored   (12369 eliminated genes)
## 
##   Level 3:   22 nodes to be scored   (19645 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (22553 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23624 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 219 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 249 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  11 nodes to be scored   (132 eliminated genes)
## 
##   Level 9:   18 nodes to be scored   (133 eliminated genes)
## 
##   Level 8:   29 nodes to be scored   (391 eliminated genes)
## 
##   Level 7:   31 nodes to be scored   (3013 eliminated genes)
## 
##   Level 6:   36 nodes to be scored   (4379 eliminated genes)
## 
##   Level 5:   45 nodes to be scored   (9211 eliminated genes)
## 
##   Level 4:   39 nodes to be scored   (12667 eliminated genes)
## 
##   Level 3:   27 nodes to be scored   (19251 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (22506 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23978 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 249 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 174 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   13 nodes to be scored   (0 eliminated genes)
## 
##   Level 7:   21 nodes to be scored   (5543 eliminated genes)
## 
##   Level 6:   30 nodes to be scored   (8668 eliminated genes)
## 
##   Level 5:   39 nodes to be scored   (9509 eliminated genes)
## 
##   Level 4:   41 nodes to be scored   (13028 eliminated genes)
## 
##   Level 3:   17 nodes to be scored   (21184 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (24809 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (33617 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 174 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 126 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   4 nodes to be scored    (60 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (68 eliminated genes)
## 
##   Level 7:   10 nodes to be scored   (5031 eliminated genes)
## 
##   Level 6:   19 nodes to be scored   (7404 eliminated genes)
## 
##   Level 5:   29 nodes to be scored   (9599 eliminated genes)
## 
##   Level 4:   29 nodes to be scored   (11950 eliminated genes)
## 
##   Level 3:   17 nodes to be scored   (20176 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (23340 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (33343 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 126 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 24 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 7:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 5:   4 nodes to be scored    (10 eliminated genes)
## 
##   Level 4:   8 nodes to be scored    (1583 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (3961 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4739 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9517 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 24 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## Warning in arrows(head_from[1], head_from[2], head_to[1], head_to[2], col =
## edgeColor, : zero-length arrow is of indeterminate angle and so skipped

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 39 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   4 nodes to be scored    (40 eliminated genes)
## 
##   Level 7:   4 nodes to be scored    (47 eliminated genes)
## 
##   Level 6:   6 nodes to be scored    (235 eliminated genes)
## 
##   Level 5:   5 nodes to be scored    (585 eliminated genes)
## 
##   Level 4:   8 nodes to be scored    (2432 eliminated genes)
## 
##   Level 3:   7 nodes to be scored    (3927 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4864 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9391 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 39 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 161 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  5 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   8 nodes to be scored    (133 eliminated genes)
## 
##   Level 8:   20 nodes to be scored   (519 eliminated genes)
## 
##   Level 7:   20 nodes to be scored   (3015 eliminated genes)
## 
##   Level 6:   25 nodes to be scored   (5216 eliminated genes)
## 
##   Level 5:   30 nodes to be scored   (8870 eliminated genes)
## 
##   Level 4:   27 nodes to be scored   (12597 eliminated genes)
## 
##   Level 3:   18 nodes to be scored   (17226 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (21550 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23508 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 161 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 144 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  3 nodes to be scored    (59 eliminated genes)
## 
##   Level 9:   6 nodes to be scored    (164 eliminated genes)
## 
##   Level 8:   9 nodes to be scored    (259 eliminated genes)
## 
##   Level 7:   21 nodes to be scored   (2870 eliminated genes)
## 
##   Level 6:   22 nodes to be scored   (3716 eliminated genes)
## 
##   Level 5:   30 nodes to be scored   (9367 eliminated genes)
## 
##   Level 4:   25 nodes to be scored   (11278 eliminated genes)
## 
##   Level 3:   18 nodes to be scored   (17993 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (22046 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23515 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 144 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 132 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   3 nodes to be scored    (60 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (68 eliminated genes)
## 
##   Level 7:   10 nodes to be scored   (4830 eliminated genes)
## 
##   Level 6:   21 nodes to be scored   (7375 eliminated genes)
## 
##   Level 5:   29 nodes to be scored   (9216 eliminated genes)
## 
##   Level 4:   33 nodes to be scored   (12302 eliminated genes)
## 
##   Level 3:   19 nodes to be scored   (20238 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (24561 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (33848 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 132 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 98 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   6 nodes to be scored    (4892 eliminated genes)
## 
##   Level 6:   14 nodes to be scored   (5860 eliminated genes)
## 
##   Level 5:   22 nodes to be scored   (9482 eliminated genes)
## 
##   Level 4:   23 nodes to be scored   (11790 eliminated genes)
## 
##   Level 3:   19 nodes to be scored   (18799 eliminated genes)
## 
##   Level 2:   7 nodes to be scored    (21393 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34720 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 98 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 24 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 7:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 5:   4 nodes to be scored    (10 eliminated genes)
## 
##   Level 4:   9 nodes to be scored    (1583 eliminated genes)
## 
##   Level 3:   5 nodes to be scored    (3996 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4883 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9164 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 24 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 27 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   1 nodes to be scored    (9 eliminated genes)
## 
##   Level 8:   1 nodes to be scored    (25 eliminated genes)
## 
##   Level 7:   3 nodes to be scored    (74 eliminated genes)
## 
##   Level 6:   5 nodes to be scored    (114 eliminated genes)
## 
##   Level 5:   4 nodes to be scored    (164 eliminated genes)
## 
##   Level 4:   5 nodes to be scored    (2841 eliminated genes)
## 
##   Level 3:   3 nodes to be scored    (3907 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4776 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (8944 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 27 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 112 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  2 nodes to be scored    (33 eliminated genes)
## 
##   Level 10:  3 nodes to be scored    (231 eliminated genes)
## 
##   Level 9:   6 nodes to be scored    (305 eliminated genes)
## 
##   Level 8:   8 nodes to be scored    (337 eliminated genes)
## 
##   Level 7:   13 nodes to be scored   (3472 eliminated genes)
## 
##   Level 6:   16 nodes to be scored   (4922 eliminated genes)
## 
##   Level 5:   21 nodes to be scored   (8380 eliminated genes)
## 
##   Level 4:   19 nodes to be scored   (11190 eliminated genes)
## 
##   Level 3:   15 nodes to be scored   (16526 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (21282 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23140 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 112 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 139 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  3 nodes to be scored    (59 eliminated genes)
## 
##   Level 9:   8 nodes to be scored    (104 eliminated genes)
## 
##   Level 8:   13 nodes to be scored   (277 eliminated genes)
## 
##   Level 7:   21 nodes to be scored   (3015 eliminated genes)
## 
##   Level 6:   23 nodes to be scored   (3496 eliminated genes)
## 
##   Level 5:   29 nodes to be scored   (8186 eliminated genes)
## 
##   Level 4:   18 nodes to be scored   (11786 eliminated genes)
## 
##   Level 3:   15 nodes to be scored   (17951 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (20593 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (22522 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 139 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 77 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   6 nodes to be scored    (4608 eliminated genes)
## 
##   Level 6:   13 nodes to be scored   (6968 eliminated genes)
## 
##   Level 5:   16 nodes to be scored   (8824 eliminated genes)
## 
##   Level 4:   15 nodes to be scored   (11258 eliminated genes)
## 
##   Level 3:   15 nodes to be scored   (15371 eliminated genes)
## 
##   Level 2:   7 nodes to be scored    (19550 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (31160 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 77 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 119 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   13 nodes to be scored   (4608 eliminated genes)
## 
##   Level 6:   21 nodes to be scored   (7912 eliminated genes)
## 
##   Level 5:   26 nodes to be scored   (9435 eliminated genes)
## 
##   Level 4:   29 nodes to be scored   (11687 eliminated genes)
## 
##   Level 3:   15 nodes to be scored   (19910 eliminated genes)
## 
##   Level 2:   7 nodes to be scored    (24055 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (33465 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 119 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 22 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   3 nodes to be scored    (68 eliminated genes)
## 
##   Level 5:   3 nodes to be scored    (134 eliminated genes)
## 
##   Level 4:   5 nodes to be scored    (2654 eliminated genes)
## 
##   Level 3:   5 nodes to be scored    (3921 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4632 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9344 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 22 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 18 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 6:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 5:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 4:   4 nodes to be scored    (1610 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (2412 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4631 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9343 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 18 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 387 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  5 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  13 nodes to be scored   (84 eliminated genes)
## 
##   Level 9:   23 nodes to be scored   (270 eliminated genes)
## 
##   Level 8:   45 nodes to be scored   (853 eliminated genes)
## 
##   Level 7:   60 nodes to be scored   (3892 eliminated genes)
## 
##   Level 6:   57 nodes to be scored   (6812 eliminated genes)
## 
##   Level 5:   72 nodes to be scored   (12823 eliminated genes)
## 
##   Level 4:   63 nodes to be scored   (15041 eliminated genes)
## 
##   Level 3:   36 nodes to be scored   (20769 eliminated genes)
## 
##   Level 2:   10 nodes to be scored   (23158 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23671 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 387 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 353 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  9 nodes to be scored    (344 eliminated genes)
## 
##   Level 9:   23 nodes to be scored   (367 eliminated genes)
## 
##   Level 8:   35 nodes to be scored   (710 eliminated genes)
## 
##   Level 7:   55 nodes to be scored   (4156 eliminated genes)
## 
##   Level 6:   59 nodes to be scored   (6984 eliminated genes)
## 
##   Level 5:   69 nodes to be scored   (12787 eliminated genes)
## 
##   Level 4:   48 nodes to be scored   (15428 eliminated genes)
## 
##   Level 3:   37 nodes to be scored   (20470 eliminated genes)
## 
##   Level 2:   11 nodes to be scored   (22900 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (24130 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 353 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 292 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   21 nodes to be scored   (75 eliminated genes)
## 
##   Level 7:   36 nodes to be scored   (5532 eliminated genes)
## 
##   Level 6:   58 nodes to be scored   (9471 eliminated genes)
## 
##   Level 5:   69 nodes to be scored   (11629 eliminated genes)
## 
##   Level 4:   60 nodes to be scored   (15203 eliminated genes)
## 
##   Level 3:   25 nodes to be scored   (23767 eliminated genes)
## 
##   Level 2:   13 nodes to be scored   (26626 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (35035 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 292 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 247 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   8 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   25 nodes to be scored   (47 eliminated genes)
## 
##   Level 7:   34 nodes to be scored   (5664 eliminated genes)
## 
##   Level 6:   51 nodes to be scored   (9313 eliminated genes)
## 
##   Level 5:   48 nodes to be scored   (10695 eliminated genes)
## 
##   Level 4:   47 nodes to be scored   (15159 eliminated genes)
## 
##   Level 3:   22 nodes to be scored   (23442 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (26344 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34178 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 247 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 90 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  5 nodes to be scored    (13 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (31 eliminated genes)
## 
##   Level 8:   8 nodes to be scored    (78 eliminated genes)
## 
##   Level 7:   11 nodes to be scored   (109 eliminated genes)
## 
##   Level 6:   13 nodes to be scored   (558 eliminated genes)
## 
##   Level 5:   15 nodes to be scored   (1290 eliminated genes)
## 
##   Level 4:   15 nodes to be scored   (2976 eliminated genes)
## 
##   Level 3:   8 nodes to be scored    (4192 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (5244 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9611 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 90 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 42 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   3 nodes to be scored    (90 eliminated genes)
## 
##   Level 6:   7 nodes to be scored    (237 eliminated genes)
## 
##   Level 5:   7 nodes to be scored    (824 eliminated genes)
## 
##   Level 4:   8 nodes to be scored    (2118 eliminated genes)
## 
##   Level 3:   9 nodes to be scored    (4166 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4848 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9495 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 42 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 203 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  2 nodes to be scored    (33 eliminated genes)
## 
##   Level 10:  6 nodes to be scored    (339 eliminated genes)
## 
##   Level 9:   15 nodes to be scored   (346 eliminated genes)
## 
##   Level 8:   21 nodes to be scored   (787 eliminated genes)
## 
##   Level 7:   26 nodes to be scored   (3776 eliminated genes)
## 
##   Level 6:   32 nodes to be scored   (5699 eliminated genes)
## 
##   Level 5:   35 nodes to be scored   (10771 eliminated genes)
## 
##   Level 4:   32 nodes to be scored   (13695 eliminated genes)
## 
##   Level 3:   24 nodes to be scored   (19443 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (22037 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23570 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 203 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 160 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (33 eliminated genes)
## 
##   Level 9:   11 nodes to be scored   (53 eliminated genes)
## 
##   Level 8:   14 nodes to be scored   (56 eliminated genes)
## 
##   Level 7:   21 nodes to be scored   (3699 eliminated genes)
## 
##   Level 6:   23 nodes to be scored   (4891 eliminated genes)
## 
##   Level 5:   30 nodes to be scored   (9339 eliminated genes)
## 
##   Level 4:   26 nodes to be scored   (12394 eliminated genes)
## 
##   Level 3:   21 nodes to be scored   (19201 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (22464 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23807 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 160 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 110 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   13 nodes to be scored   (4608 eliminated genes)
## 
##   Level 6:   17 nodes to be scored   (7881 eliminated genes)
## 
##   Level 5:   22 nodes to be scored   (10114 eliminated genes)
## 
##   Level 4:   26 nodes to be scored   (12227 eliminated genes)
## 
##   Level 3:   17 nodes to be scored   (19578 eliminated genes)
## 
##   Level 2:   7 nodes to be scored    (24111 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34217 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 110 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 137 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   12 nodes to be scored   (0 eliminated genes)
## 
##   Level 7:   19 nodes to be scored   (4926 eliminated genes)
## 
##   Level 6:   27 nodes to be scored   (7988 eliminated genes)
## 
##   Level 5:   27 nodes to be scored   (9660 eliminated genes)
## 
##   Level 4:   24 nodes to be scored   (12422 eliminated genes)
## 
##   Level 3:   17 nodes to be scored   (20397 eliminated genes)
## 
##   Level 2:   7 nodes to be scored    (23436 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (33252 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 137 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 35 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   1 nodes to be scored    (17 eliminated genes)
## 
##   Level 8:   1 nodes to be scored    (20 eliminated genes)
## 
##   Level 7:   3 nodes to be scored    (22 eliminated genes)
## 
##   Level 6:   5 nodes to be scored    (79 eliminated genes)
## 
##   Level 5:   5 nodes to be scored    (301 eliminated genes)
## 
##   Level 4:   7 nodes to be scored    (2694 eliminated genes)
## 
##   Level 3:   8 nodes to be scored    (3969 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4189 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9611 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 35 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 25 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 6:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 5:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 4:   9 nodes to be scored    (1565 eliminated genes)
## 
##   Level 3:   7 nodes to be scored    (2431 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (5092 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9611 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 25 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 499 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  10 nodes to be scored   (0 eliminated genes)
## 
##   Level 10:  22 nodes to be scored   (215 eliminated genes)
## 
##   Level 9:   34 nodes to be scored   (465 eliminated genes)
## 
##   Level 8:   51 nodes to be scored   (1064 eliminated genes)
## 
##   Level 7:   72 nodes to be scored   (3910 eliminated genes)
## 
##   Level 6:   84 nodes to be scored   (5752 eliminated genes)
## 
##   Level 5:   96 nodes to be scored   (12003 eliminated genes)
## 
##   Level 4:   72 nodes to be scored   (15153 eliminated genes)
## 
##   Level 3:   41 nodes to be scored   (21043 eliminated genes)
## 
##   Level 2:   12 nodes to be scored   (23235 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (24036 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 499 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 299 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  8 nodes to be scored    (6 eliminated genes)
## 
##   Level 10:  14 nodes to be scored   (90 eliminated genes)
## 
##   Level 9:   26 nodes to be scored   (137 eliminated genes)
## 
##   Level 8:   31 nodes to be scored   (784 eliminated genes)
## 
##   Level 7:   41 nodes to be scored   (4247 eliminated genes)
## 
##   Level 6:   47 nodes to be scored   (6399 eliminated genes)
## 
##   Level 5:   46 nodes to be scored   (12385 eliminated genes)
## 
##   Level 4:   41 nodes to be scored   (15159 eliminated genes)
## 
##   Level 3:   31 nodes to be scored   (20156 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (22865 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23761 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 299 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 313 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   8 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   25 nodes to be scored   (10 eliminated genes)
## 
##   Level 7:   40 nodes to be scored   (5767 eliminated genes)
## 
##   Level 6:   56 nodes to be scored   (9880 eliminated genes)
## 
##   Level 5:   67 nodes to be scored   (11624 eliminated genes)
## 
##   Level 4:   69 nodes to be scored   (14890 eliminated genes)
## 
##   Level 3:   33 nodes to be scored   (23581 eliminated genes)
## 
##   Level 2:   13 nodes to be scored   (26925 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (35151 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 313 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 208 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   5 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   16 nodes to be scored   (0 eliminated genes)
## 
##   Level 7:   24 nodes to be scored   (5575 eliminated genes)
## 
##   Level 6:   39 nodes to be scored   (9021 eliminated genes)
## 
##   Level 5:   48 nodes to be scored   (10474 eliminated genes)
## 
##   Level 4:   45 nodes to be scored   (13428 eliminated genes)
## 
##   Level 3:   22 nodes to be scored   (22311 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (25908 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34832 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 208 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 65 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   4 nodes to be scored    (15 eliminated genes)
## 
##   Level 8:   4 nodes to be scored    (31 eliminated genes)
## 
##   Level 7:   9 nodes to be scored    (176 eliminated genes)
## 
##   Level 6:   10 nodes to be scored   (449 eliminated genes)
## 
##   Level 5:   9 nodes to be scored    (1179 eliminated genes)
## 
##   Level 4:   12 nodes to be scored   (3702 eliminated genes)
## 
##   Level 3:   10 nodes to be scored   (4040 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (5165 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9668 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 65 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 47 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   5 nodes to be scored    (26 eliminated genes)
## 
##   Level 7:   8 nodes to be scored    (38 eliminated genes)
## 
##   Level 6:   6 nodes to be scored    (322 eliminated genes)
## 
##   Level 5:   7 nodes to be scored    (1118 eliminated genes)
## 
##   Level 4:   8 nodes to be scored    (3027 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (3936 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4877 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9217 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 47 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 636 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 15:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 14:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 13:  4 nodes to be scored    (16 eliminated genes)
## 
##   Level 12:  11 nodes to be scored   (29 eliminated genes)
## 
##   Level 11:  18 nodes to be scored   (35 eliminated genes)
## 
##   Level 10:  33 nodes to be scored   (492 eliminated genes)
## 
##   Level 9:   50 nodes to be scored   (697 eliminated genes)
## 
##   Level 8:   74 nodes to be scored   (1558 eliminated genes)
## 
##   Level 7:   110 nodes to be scored  (5138 eliminated genes)
## 
##   Level 6:   108 nodes to be scored  (7604 eliminated genes)
## 
##   Level 5:   110 nodes to be scored  (14223 eliminated genes)
## 
##   Level 4:   65 nodes to be scored   (16427 eliminated genes)
## 
##   Level 3:   40 nodes to be scored   (21426 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (23250 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (24151 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 636 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 550 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  6 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  9 nodes to be scored    (19 eliminated genes)
## 
##   Level 10:  31 nodes to be scored   (223 eliminated genes)
## 
##   Level 9:   59 nodes to be scored   (494 eliminated genes)
## 
##   Level 8:   76 nodes to be scored   (1317 eliminated genes)
## 
##   Level 7:   83 nodes to be scored   (5156 eliminated genes)
## 
##   Level 6:   82 nodes to be scored   (8112 eliminated genes)
## 
##   Level 5:   88 nodes to be scored   (14026 eliminated genes)
## 
##   Level 4:   65 nodes to be scored   (15871 eliminated genes)
## 
##   Level 3:   39 nodes to be scored   (20819 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (23472 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (24090 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 550 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 361 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   8 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   29 nodes to be scored   (10 eliminated genes)
## 
##   Level 7:   49 nodes to be scored   (5693 eliminated genes)
## 
##   Level 6:   70 nodes to be scored   (9945 eliminated genes)
## 
##   Level 5:   80 nodes to be scored   (11800 eliminated genes)
## 
##   Level 4:   77 nodes to be scored   (15544 eliminated genes)
## 
##   Level 3:   31 nodes to be scored   (24412 eliminated genes)
## 
##   Level 2:   15 nodes to be scored   (27514 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34973 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 361 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 359 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   13 nodes to be scored   (60 eliminated genes)
## 
##   Level 8:   31 nodes to be scored   (143 eliminated genes)
## 
##   Level 7:   47 nodes to be scored   (5958 eliminated genes)
## 
##   Level 6:   81 nodes to be scored   (9809 eliminated genes)
## 
##   Level 5:   71 nodes to be scored   (11839 eliminated genes)
## 
##   Level 4:   69 nodes to be scored   (16204 eliminated genes)
## 
##   Level 3:   27 nodes to be scored   (23960 eliminated genes)
## 
##   Level 2:   14 nodes to be scored   (27294 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (35103 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 359 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 112 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  5 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  7 nodes to be scored    (13 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (59 eliminated genes)
## 
##   Level 8:   12 nodes to be scored   (106 eliminated genes)
## 
##   Level 7:   14 nodes to be scored   (145 eliminated genes)
## 
##   Level 6:   14 nodes to be scored   (736 eliminated genes)
## 
##   Level 5:   17 nodes to be scored   (1571 eliminated genes)
## 
##   Level 4:   19 nodes to be scored   (3577 eliminated genes)
## 
##   Level 3:   13 nodes to be scored   (4205 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (5350 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9658 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 112 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 97 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   12 nodes to be scored   (81 eliminated genes)
## 
##   Level 7:   13 nodes to be scored   (184 eliminated genes)
## 
##   Level 6:   15 nodes to be scored   (737 eliminated genes)
## 
##   Level 5:   15 nodes to be scored   (1625 eliminated genes)
## 
##   Level 4:   14 nodes to be scored   (3765 eliminated genes)
## 
##   Level 3:   14 nodes to be scored   (4221 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (5193 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9552 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 97 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## Warning in arrows(head_from[1], head_from[2], head_to[1], head_to[2], col =
## edgeColor, : zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(head_from[1], head_from[2], head_to[1], head_to[2], col =
## edgeColor, : zero-length arrow is of indeterminate angle and so skipped

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 484 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  5 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  7 nodes to be scored    (6 eliminated genes)
## 
##   Level 10:  26 nodes to be scored   (205 eliminated genes)
## 
##   Level 9:   41 nodes to be scored   (219 eliminated genes)
## 
##   Level 8:   64 nodes to be scored   (1057 eliminated genes)
## 
##   Level 7:   70 nodes to be scored   (4518 eliminated genes)
## 
##   Level 6:   76 nodes to be scored   (7288 eliminated genes)
## 
##   Level 5:   83 nodes to be scored   (12636 eliminated genes)
## 
##   Level 4:   63 nodes to be scored   (15851 eliminated genes)
## 
##   Level 3:   37 nodes to be scored   (20892 eliminated genes)
## 
##   Level 2:   10 nodes to be scored   (23501 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (24028 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 484 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 452 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 15:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 14:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 13:  2 nodes to be scored    (16 eliminated genes)
## 
##   Level 12:  10 nodes to be scored   (21 eliminated genes)
## 
##   Level 11:  15 nodes to be scored   (26 eliminated genes)
## 
##   Level 10:  26 nodes to be scored   (261 eliminated genes)
## 
##   Level 9:   38 nodes to be scored   (441 eliminated genes)
## 
##   Level 8:   56 nodes to be scored   (1192 eliminated genes)
## 
##   Level 7:   64 nodes to be scored   (4264 eliminated genes)
## 
##   Level 6:   68 nodes to be scored   (6981 eliminated genes)
## 
##   Level 5:   78 nodes to be scored   (12343 eliminated genes)
## 
##   Level 4:   53 nodes to be scored   (14731 eliminated genes)
## 
##   Level 3:   30 nodes to be scored   (20550 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (23152 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23749 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 452 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 309 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   10 nodes to be scored   (60 eliminated genes)
## 
##   Level 8:   24 nodes to be scored   (154 eliminated genes)
## 
##   Level 7:   38 nodes to be scored   (5908 eliminated genes)
## 
##   Level 6:   57 nodes to be scored   (9900 eliminated genes)
## 
##   Level 5:   73 nodes to be scored   (11632 eliminated genes)
## 
##   Level 4:   64 nodes to be scored   (15188 eliminated genes)
## 
##   Level 3:   25 nodes to be scored   (24083 eliminated genes)
## 
##   Level 2:   12 nodes to be scored   (27051 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34423 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 309 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 264 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   15 nodes to be scored   (23 eliminated genes)
## 
##   Level 7:   35 nodes to be scored   (5148 eliminated genes)
## 
##   Level 6:   52 nodes to be scored   (8548 eliminated genes)
## 
##   Level 5:   64 nodes to be scored   (11188 eliminated genes)
## 
##   Level 4:   53 nodes to be scored   (14728 eliminated genes)
## 
##   Level 3:   25 nodes to be scored   (23961 eliminated genes)
## 
##   Level 2:   11 nodes to be scored   (26503 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34850 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 264 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 82 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   10 nodes to be scored   (54 eliminated genes)
## 
##   Level 7:   13 nodes to be scored   (61 eliminated genes)
## 
##   Level 6:   12 nodes to be scored   (491 eliminated genes)
## 
##   Level 5:   14 nodes to be scored   (1587 eliminated genes)
## 
##   Level 4:   16 nodes to be scored   (2848 eliminated genes)
## 
##   Level 3:   10 nodes to be scored   (4099 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (5379 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9668 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 82 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 35 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   3 nodes to be scored    (12 eliminated genes)
## 
##   Level 7:   4 nodes to be scored    (24 eliminated genes)
## 
##   Level 6:   5 nodes to be scored    (410 eliminated genes)
## 
##   Level 5:   4 nodes to be scored    (971 eliminated genes)
## 
##   Level 4:   7 nodes to be scored    (2913 eliminated genes)
## 
##   Level 3:   7 nodes to be scored    (3918 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4830 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9217 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 35 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 221 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 14:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  3 nodes to be scored    (21 eliminated genes)
## 
##   Level 11:  6 nodes to be scored    (21 eliminated genes)
## 
##   Level 10:  6 nodes to be scored    (62 eliminated genes)
## 
##   Level 9:   12 nodes to be scored   (225 eliminated genes)
## 
##   Level 8:   14 nodes to be scored   (416 eliminated genes)
## 
##   Level 7:   25 nodes to be scored   (3750 eliminated genes)
## 
##   Level 6:   35 nodes to be scored   (4949 eliminated genes)
## 
##   Level 5:   45 nodes to be scored   (10446 eliminated genes)
## 
##   Level 4:   38 nodes to be scored   (12892 eliminated genes)
## 
##   Level 3:   26 nodes to be scored   (19700 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (22883 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23935 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 221 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 200 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   8 nodes to be scored    (15 eliminated genes)
## 
##   Level 8:   20 nodes to be scored   (130 eliminated genes)
## 
##   Level 7:   30 nodes to be scored   (3043 eliminated genes)
## 
##   Level 6:   37 nodes to be scored   (4709 eliminated genes)
## 
##   Level 5:   39 nodes to be scored   (9271 eliminated genes)
## 
##   Level 4:   33 nodes to be scored   (13513 eliminated genes)
## 
##   Level 3:   20 nodes to be scored   (18253 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (22910 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23887 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 200 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 186 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   13 nodes to be scored   (0 eliminated genes)
## 
##   Level 7:   19 nodes to be scored   (5543 eliminated genes)
## 
##   Level 6:   33 nodes to be scored   (8665 eliminated genes)
## 
##   Level 5:   43 nodes to be scored   (9341 eliminated genes)
## 
##   Level 4:   43 nodes to be scored   (13180 eliminated genes)
## 
##   Level 3:   19 nodes to be scored   (21091 eliminated genes)
## 
##   Level 2:   11 nodes to be scored   (24823 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (34270 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 186 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 123 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   4 nodes to be scored    (60 eliminated genes)
## 
##   Level 8:   9 nodes to be scored    (84 eliminated genes)
## 
##   Level 7:   14 nodes to be scored   (4995 eliminated genes)
## 
##   Level 6:   18 nodes to be scored   (7668 eliminated genes)
## 
##   Level 5:   26 nodes to be scored   (10505 eliminated genes)
## 
##   Level 4:   26 nodes to be scored   (12195 eliminated genes)
## 
##   Level 3:   14 nodes to be scored   (20261 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (24120 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (32363 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 123 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 42 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   2 nodes to be scored    (12 eliminated genes)
## 
##   Level 8:   3 nodes to be scored    (26 eliminated genes)
## 
##   Level 7:   3 nodes to be scored    (38 eliminated genes)
## 
##   Level 6:   3 nodes to be scored    (176 eliminated genes)
## 
##   Level 5:   6 nodes to be scored    (961 eliminated genes)
## 
##   Level 4:   11 nodes to be scored   (2654 eliminated genes)
## 
##   Level 3:   8 nodes to be scored    (3972 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4934 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9611 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 42 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 24 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 6:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 5:   5 nodes to be scored    (0 eliminated genes)
## 
##   Level 4:   8 nodes to be scored    (1551 eliminated genes)
## 
##   Level 3:   7 nodes to be scored    (2452 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4853 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9611 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 24 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 138 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   5 nodes to be scored    (7 eliminated genes)
## 
##   Level 8:   13 nodes to be scored   (184 eliminated genes)
## 
##   Level 7:   20 nodes to be scored   (2843 eliminated genes)
## 
##   Level 6:   23 nodes to be scored   (4523 eliminated genes)
## 
##   Level 5:   30 nodes to be scored   (10100 eliminated genes)
## 
##   Level 4:   21 nodes to be scored   (12019 eliminated genes)
## 
##   Level 3:   17 nodes to be scored   (18436 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (20649 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (22544 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 138 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 116 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   5 nodes to be scored    (67 eliminated genes)
## 
##   Level 8:   10 nodes to be scored   (75 eliminated genes)
## 
##   Level 7:   16 nodes to be scored   (2850 eliminated genes)
## 
##   Level 6:   19 nodes to be scored   (3951 eliminated genes)
## 
##   Level 5:   24 nodes to be scored   (8674 eliminated genes)
## 
##   Level 4:   19 nodes to be scored   (11285 eliminated genes)
## 
##   Level 3:   14 nodes to be scored   (16000 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (21414 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23464 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 116 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 106 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   10 nodes to be scored   (4608 eliminated genes)
## 
##   Level 6:   18 nodes to be scored   (7057 eliminated genes)
## 
##   Level 5:   23 nodes to be scored   (8900 eliminated genes)
## 
##   Level 4:   26 nodes to be scored   (11155 eliminated genes)
## 
##   Level 3:   15 nodes to be scored   (17408 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (22884 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (33757 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 106 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 72 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   5 nodes to be scored    (4892 eliminated genes)
## 
##   Level 6:   11 nodes to be scored   (6947 eliminated genes)
## 
##   Level 5:   14 nodes to be scored   (9202 eliminated genes)
## 
##   Level 4:   13 nodes to be scored   (11195 eliminated genes)
## 
##   Level 3:   16 nodes to be scored   (17099 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (18549 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (33254 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 72 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 23 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   4 nodes to be scored    (49 eliminated genes)
## 
##   Level 5:   3 nodes to be scored    (127 eliminated genes)
## 
##   Level 4:   4 nodes to be scored    (2470 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (3966 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4615 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9058 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 23 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 30 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   1 nodes to be scored    (9 eliminated genes)
## 
##   Level 8:   2 nodes to be scored    (25 eliminated genes)
## 
##   Level 7:   4 nodes to be scored    (74 eliminated genes)
## 
##   Level 6:   6 nodes to be scored    (182 eliminated genes)
## 
##   Level 5:   4 nodes to be scored    (299 eliminated genes)
## 
##   Level 4:   5 nodes to be scored    (3200 eliminated genes)
## 
##   Level 3:   3 nodes to be scored    (3907 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4776 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (8944 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 30 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1284 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2894 GO terms and 5659 relations. )
## 
## Annotating nodes ...............
##  ( 24345 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 123 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  3 nodes to be scored    (33 eliminated genes)
## 
##   Level 10:  4 nodes to be scored    (231 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (312 eliminated genes)
## 
##   Level 8:   7 nodes to be scored    (438 eliminated genes)
## 
##   Level 7:   14 nodes to be scored   (3649 eliminated genes)
## 
##   Level 6:   17 nodes to be scored   (4870 eliminated genes)
## 
##   Level 5:   24 nodes to be scored   (8824 eliminated genes)
## 
##   Level 4:   22 nodes to be scored   (10075 eliminated genes)
## 
##   Level 3:   16 nodes to be scored   (16653 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (21364 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23529 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 123 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 183 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (11 eliminated genes)
## 
##   Level 8:   21 nodes to be scored   (132 eliminated genes)
## 
##   Level 7:   21 nodes to be scored   (2948 eliminated genes)
## 
##   Level 6:   25 nodes to be scored   (5335 eliminated genes)
## 
##   Level 5:   37 nodes to be scored   (9125 eliminated genes)
## 
##   Level 4:   36 nodes to be scored   (13048 eliminated genes)
## 
##   Level 3:   22 nodes to be scored   (15840 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (21895 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23545 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 183 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1346 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1777 GO terms and 2313 relations. )
## 
## Annotating nodes ...............
##  ( 35716 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 83 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   7 nodes to be scored    (4608 eliminated genes)
## 
##   Level 6:   14 nodes to be scored   (6968 eliminated genes)
## 
##   Level 5:   20 nodes to be scored   (8843 eliminated genes)
## 
##   Level 4:   16 nodes to be scored   (11494 eliminated genes)
## 
##   Level 3:   15 nodes to be scored   (18373 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (20441 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (31993 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 83 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 133 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   2 nodes to be scored    (60 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (68 eliminated genes)
## 
##   Level 7:   10 nodes to be scored   (4695 eliminated genes)
## 
##   Level 6:   20 nodes to be scored   (7855 eliminated genes)
## 
##   Level 5:   30 nodes to be scored   (9090 eliminated genes)
## 
##   Level 4:   33 nodes to be scored   (11839 eliminated genes)
## 
##   Level 3:   19 nodes to be scored   (20314 eliminated genes)
## 
##   Level 2:   10 nodes to be scored   (23550 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (33848 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 133 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 379 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 608 GO terms and 1042 relations. )
## 
## Annotating nodes ...............
##  ( 9775 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 19 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 7:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 5:   3 nodes to be scored    (17 eliminated genes)
## 
##   Level 4:   5 nodes to be scored    (2654 eliminated genes)
## 
##   Level 3:   4 nodes to be scored    (3921 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4632 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9297 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 19 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 28 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   2 nodes to be scored    (68 eliminated genes)
## 
##   Level 5:   5 nodes to be scored    (135 eliminated genes)
## 
##   Level 4:   10 nodes to be scored   (1911 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (4010 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4900 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9517 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 28 nontrivial nodes
##       parameters: 
##           test statistic: fisher

2.2 Insect

2.2.1 Import des données pour l’analyse TopGO sur les échantillons issus des insect

# Annotations GO (InterProScan)
interproscan <- read.delim('TopGO/Insect/gene_GO.txt', 
   header = FALSE, sep = '\t')
head(interproscan)
##                                                          V1         V2
## 1 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294_orf25253 GO:0003883
## 2 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294_orf25253 GO:0006241
## 3 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294_orf25253 GO:0003883
## 4 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294_orf25253 GO:0006221
## 5 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294_orf25253 GO:0003883
## 6 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294_orf25253 GO:0006221
interproscan$V1 <- vapply(interproscan$V1, 
                          function(x) gsub('_orf[0-9]+', '', x), character(1))
#take out the orf part

interproscan <- as.data.frame(interproscan)
head(interproscan)
##                                                 V1         V2
## 1 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294 GO:0003883
## 2 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294 GO:0006241
## 3 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294 GO:0003883
## 4 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294 GO:0006221
## 5 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294 GO:0003883
## 6 lcl|NZ_CACTIE010000113.1_cds_WP_181994785.1_1294 GO:0006221
# Vérifier la structure des fichiers
if (ncol(interproscan) < 2) 
  stop('Erreur : Le fichier interproscan semble mal formaté.')

# Définir la liste des conditions d’intérêt
select_cond=c("B_t1_Q11L, B_t1_Q11V_L", "B_t1_Q21L, B_t1_Q21V_L", "B_t2_Q11L,
              B_t2_Q11V_L", "B_t2_Q21L, B_t2_Q21V_L", "B_t1_Q11V_L, 
              B_t2_Q11V_L", "B_t1_Q21V_L, B_t2_Q21V_L", "B_t1_Q11L, B_t2_Q11L",
              "B_t1_Q21L, B_t2_Q21L", "B_t1_Q11L, B_t1_Q21L", "B_t1_Q11V_L,
              B_t1_Q21V_L", "B_t2_Q11L, B_t2_Q21L", "B_t2_Q11V_L, B_t2_Q21V_L")

# Lire les lignes du fichier contenant les chemins et infos 
lines_raw <- readLines("TopGO/Insect/liste_deseq.txt")

# Initialiser une liste de résultats 
chemins_trouves <- data.frame(ID1 = character(),
                              ID2 = character(),
                              chemin = character(),
                              info = character(),
                              stringsAsFactors = FALSE)

# Recherche des lignes correspondantes à chaque couple
for (cond in select_cond) {
  ids <- str_split(cond, ",\\s*")[[1]]
  id1 <- ids[1]
  id2 <- ids[2]
  
  # Match la ligne contenant les deux identifiants dans le nom du fichier
  match_lines <- lines_raw[str_detect(lines_raw, fixed(id1)) & 
                             str_detect(lines_raw, fixed(id2))]
  
  for (line in match_lines) {
    # Séparer le chemin et l'info
    parts <- str_split(line, ",\\s*")[[1]]
    chemin <- parts[1]
    info <- ifelse(length(parts) > 1, parts[2], NA)

    if (!is.na(chemin) && file.exists(chemin)) {
      chemins_trouves <- rbind(
        chemins_trouves,
        data.frame(ID1 = id1, ID2 = id2, chemin = chemin, info = info, 
                   stringsAsFactors = FALSE)
      )
    } else {
      warning(paste("Fichier introuvable ou chemin invalide:", chemin))
    }
  }
}

# Importer et annoter les tableaux
list_tables <- list()

for (i in 1:nrow(chemins_trouves)) {
  path <- chemins_trouves$chemin[i]
  id_label <- paste(chemins_trouves$ID1[i], chemins_trouves$ID2[i], 
                    sep = "_VS_")
  info_val <- chemins_trouves$info[i]

  df <- tryCatch({
    read_delim(path, delim = ",", show_col_types = FALSE)
  }, error = function(e) {
    warning(paste("Erreur lors de l'import:", path))
    return(NULL)
  })

  if (!is.null(df)) {
    df$ID <- id_label
    df$Info <- info_val
    df_2 <- subset(df,padj < 0.05 & abs(log2FoldChange) > 1 & padj != 0) 
    #use subset to filter dataframes by columns
    list_tables[[length(list_tables) + 1]] <- df_2
  }
}
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## • `` -> `...1`
# Fusionner tous les tableaux 
table_fusionnee <- bind_rows(list_tables)
colnames(table_fusionnee)[1] <- "gene_id"

# Aperçu ou sauvegarde
print(head(table_fusionnee))
## # A tibble: 6 × 9
##   gene_id     baseMean log2FoldChange lfcSE   stat   pvalue     padj ID    Info 
##   <chr>          <dbl>          <dbl> <dbl>  <dbl>    <dbl>    <dbl> <chr> <chr>
## 1 lcl|NC_092…    134.           -20.7  1.54 -13.4  4.49e-41 1.03e-36 B_t1… Inse…
## 2 lcl|NC_092…     17.9          -18.3  2.04  -8.98 2.64e-19 3.04e-15 B_t1… Inse…
## 3 lcl|NC_092…     76.1          -19.2  2.30  -8.32 8.53e-17 6.55e-13 B_t1… Inse…
## 4 lcl|NC_092…     43.0           22.9  2.76   8.28 1.27e-16 7.30e-13 B_t1… Inse…
## 5 lcl|NC_092…     36.6          -20.2  2.59  -7.79 6.45e-15 2.97e-11 B_t1… Inse…
## 6 lcl|NC_092…     59.8           22.6  3.03   7.47 7.83e-14 3.01e-10 B_t1… Inse…
#write_csv(table_fusionnee, "TopGO/Insect/table_fusionnee.csv")


# Vérifier le nombre de gènes significatifs
cat('Nombre de gènes différentiellement exprimés :',
    nrow(table_fusionnee), '\\n')
## Nombre de gènes différentiellement exprimés : 4953 \n
# Renommer les colonnes du fichier interproscan
colnames(interproscan)[1:2] <- c('GeneID', 'GO')

# Supprimer les lignes sans GO
interproscan <- interproscan[!is.na(interproscan$GO) & interproscan$GO != '', ]

# Associer chaque gène à ses termes GO
gene2GO <- split(interproscan$GO, interproscan$GeneID)
gene2GO <- lapply(gene2GO, function(x) unique(unlist(strsplit(x, ';'))))

# Définir l'univers des gènes et la liste binaire des gènes significatifs
geneUniverse <- names(gene2GO)

ont_list=c("BP", "MF", "CC")
#BP = Biological Process, MF = Molecular Function, CC = Cellular Component

2.2.2 Formalisations des données, tests et représentations graphiques

for (i in unique(table_fusionnee$ID)){
  table_trimmed = subset(table_fusionnee, ID == i)
  up_table = subset(table_trimmed, log2FoldChange >= 1)
  down_table = subset(table_trimmed, log2FoldChange <= -1)
  geneList_up <- factor(as.integer(geneUniverse %in% up_table$gene_id),
                        levels = c(0, 1))
  geneList_down <- factor(as.integer(geneUniverse %in% down_table$gene_id),
                          levels = c(0, 1))

  for (y in ont_list){
    condition = i
    orga = table_fusionnee$Info[i]
    ontology = y

    names(geneList_up) <- geneUniverse
    names(geneList_down) <- geneUniverse

    # Création des objets topGO
    GOdata_up <- new('topGOdata',
        description = "Enrichment analysis",
        ontology = y, 
        allGenes = geneList_up,
        annot = annFUN.gene2GO,
        geneSelectionFun = function(x) x == 1,
        gene2GO = gene2GO,
        nodeSize = 5)
    GOdata_down <- new('topGOdata',
        description = "Enrichment analysis",
        ontology = y, 
        allGenes = geneList_down,
        annot = annFUN.gene2GO,
        geneSelectionFun = function(x) x == 1,
        gene2GO = gene2GO,
        nodeSize = 5)

    # UP
    resultFisher_up_w01 <- runTest(GOdata_up, algorithm = 'weight01',
                                   statistic = 'fisher')
    resultFisher_up_classic <- runTest(GOdata_up, algorithm = 'classic',
                                       statistic = 'fisher')
    GOtable_up <- GenTable(GOdata_up, p.value = resultFisher_up_w01,
                           orderBy = 'p.value', topNodes = 20)
    GOtable_up
#    write.csv(GOtable_up, paste0('TopGO/Insect/TopGO_Down/topGO_results_up_',
#                                 i, '_', y, '.csv'), row.names = FALSE)
    allRes <- GenTable(GOdata_down, classic = resultFisher_up_classic, 
                       weight = resultFisher_up_w01, orderBy = "weight", 
                       ranksOf = "weight", topNodes = 20)
    knitr::kable(allRes)
#    GO.res <- 
    showSigOfNodes(GOdata_up, score(resultFisher_up_classic), 
                             firstSigNodes = 20, useInfo = 'all')

    # DOWN
    resultFisher_down_w01 <- runTest(GOdata_down, algorithm = 'weight01',
                                     statistic = 'fisher')
    resultFisher_down_classic <- runTest(GOdata_down, algorithm = 'classic',
                                         statistic = 'fisher')
    GOtable_down <- GenTable(GOdata_down, p.value = resultFisher_down_w01,
                             orderBy = 'p.value', topNodes = 20)
    GOtable_down
#    write.csv(GOtable_down, paste0('TopGO/Insect/TopGO_Up/topGO_results_down_',
#                                   i, '_', y, '.csv'), row.names = FALSE)

    # FILTRER p.value
    GOtable_up_filt <- GOtable_up[as.numeric(GOtable_up$p.value) < 0.05, ]
    GOtable_down_filt <- GOtable_down[as.numeric(GOtable_down$p.value) < 0.05, ]

    if (nrow(GOtable_up_filt) == 0 && nrow(GOtable_down_filt) == 0) {
      next  # passer à la prochaine itération du for(y in ont_list)
    }

    # Ajouter colonne Direction et inv_pvalue
    if (nrow(GOtable_up_filt) > 0) {
      GOtable_up_filt$Direction <- "Up"
      GOtable_up_filt$p.value <- as.numeric(GOtable_up_filt$p.value)
      GOtable_up_filt$inv_pvalue <- GOtable_up_filt$p.value
    }

    if (nrow(GOtable_down_filt) > 0) {
      GOtable_down_filt$Direction <- "Down"
      GOtable_down_filt$p.value <- as.numeric(GOtable_down_filt$p.value)
      GOtable_down_filt$inv_pvalue <- 1 / GOtable_down_filt$p.value
    }

    # Fusionner uniquement ceux qui existent
    GOtable_filt <- rbind(
      if (exists("GOtable_up_filt")) GOtable_up_filt else NULL,
      if (exists("GOtable_down_filt")) GOtable_down_filt else NULL
    )

    # Tracer
    g <- ggplot(GOtable_filt, aes(x = reorder(Term, -log10(
      as.numeric(inv_pvalue))), 
                                  y = -log10(as.numeric(inv_pvalue)))) +
      geom_bar(stat = 'identity', fill = '#00a3a6') +
      geom_hline(yintercept = -log10(0.05), color = 'red', linetype = 
                   'dashed', linewidth = 1) +
      geom_hline(yintercept = -log10(1 / 0.05), color = 'red', linetype = 
                   'dashed', linewidth = 1) +
      geom_hline(yintercept = 0, color = 'white', linewidth = 0.5) +
      coord_flip() +
      labs(x = 'Termes GO', y = '-log10[p-value]', title = i)
    print(g)
#    ggsave(paste0("TopGO/Insect/topGO_results_", i, '_', y, '.pdf'), plot = g)
    allRes <- GenTable(GOdata_down, classic = resultFisher_down_classic, 
                       weight = resultFisher_down_w01, orderBy = "weight", 
                       ranksOf = "weight", topNodes = 20)
    knitr::kable(allRes)
#    GO.res <- 
    showSigOfNodes(GOdata_down, topGO::score(resultFisher_down_classic), 
                             firstSigNodes = 20, useInfo = 'all')
  }
}
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 114 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   6 nodes to be scored    (32 eliminated genes)
## 
##   Level 8:   11 nodes to be scored   (60 eliminated genes)
## 
##   Level 7:   15 nodes to be scored   (1941 eliminated genes)
## 
##   Level 6:   17 nodes to be scored   (2528 eliminated genes)
## 
##   Level 5:   24 nodes to be scored   (4997 eliminated genes)
## 
##   Level 4:   17 nodes to be scored   (7451 eliminated genes)
## 
##   Level 3:   12 nodes to be scored   (14850 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (16498 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (17440 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 114 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 109 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  3 nodes to be scored    (34 eliminated genes)
## 
##   Level 10:  6 nodes to be scored    (34 eliminated genes)
## 
##   Level 9:   8 nodes to be scored    (34 eliminated genes)
## 
##   Level 8:   12 nodes to be scored   (49 eliminated genes)
## 
##   Level 7:   15 nodes to be scored   (2000 eliminated genes)
## 
##   Level 6:   14 nodes to be scored   (2657 eliminated genes)
## 
##   Level 5:   18 nodes to be scored   (4483 eliminated genes)
## 
##   Level 4:   14 nodes to be scored   (5156 eliminated genes)
## 
##   Level 3:   11 nodes to be scored   (10839 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (15518 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (17726 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 109 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 92 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   5 nodes to be scored    (78 eliminated genes)
## 
##   Level 7:   9 nodes to be scored    (3502 eliminated genes)
## 
##   Level 6:   14 nodes to be scored   (4712 eliminated genes)
## 
##   Level 5:   22 nodes to be scored   (6521 eliminated genes)
## 
##   Level 4:   17 nodes to be scored   (8423 eliminated genes)
## 
##   Level 3:   12 nodes to be scored   (14091 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (15721 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (26485 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 92 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 75 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   8 nodes to be scored    (3820 eliminated genes)
## 
##   Level 6:   10 nodes to be scored   (5069 eliminated genes)
## 
##   Level 5:   13 nodes to be scored   (5940 eliminated genes)
## 
##   Level 4:   16 nodes to be scored   (8158 eliminated genes)
## 
##   Level 3:   13 nodes to be scored   (11373 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (14441 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23404 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 75 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 22 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   2 nodes to be scored    (78 eliminated genes)
## 
##   Level 6:   2 nodes to be scored    (250 eliminated genes)
## 
##   Level 5:   3 nodes to be scored    (433 eliminated genes)
## 
##   Level 4:   4 nodes to be scored    (800 eliminated genes)
## 
##   Level 3:   5 nodes to be scored    (2002 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4191 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9434 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 22 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 4 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 3:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 2:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (5993 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 4 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 92 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  3 nodes to be scored    (22 eliminated genes)
## 
##   Level 10:  4 nodes to be scored    (30 eliminated genes)
## 
##   Level 9:   4 nodes to be scored    (44 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (89 eliminated genes)
## 
##   Level 7:   10 nodes to be scored   (2025 eliminated genes)
## 
##   Level 6:   12 nodes to be scored   (3010 eliminated genes)
## 
##   Level 5:   16 nodes to be scored   (5359 eliminated genes)
## 
##   Level 4:   15 nodes to be scored   (6682 eliminated genes)
## 
##   Level 3:   11 nodes to be scored   (12757 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (17446 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18551 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 92 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 80 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   4 nodes to be scored    (12 eliminated genes)
## 
##   Level 8:   8 nodes to be scored    (362 eliminated genes)
## 
##   Level 7:   8 nodes to be scored    (1806 eliminated genes)
## 
##   Level 6:   9 nodes to be scored    (2369 eliminated genes)
## 
##   Level 5:   16 nodes to be scored   (3293 eliminated genes)
## 
##   Level 4:   13 nodes to be scored   (5294 eliminated genes)
## 
##   Level 3:   12 nodes to be scored   (12809 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (15685 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (17734 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 80 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 71 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   9 nodes to be scored    (3280 eliminated genes)
## 
##   Level 6:   12 nodes to be scored   (3402 eliminated genes)
## 
##   Level 5:   14 nodes to be scored   (4247 eliminated genes)
## 
##   Level 4:   13 nodes to be scored   (4860 eliminated genes)
## 
##   Level 3:   12 nodes to be scored   (12510 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (14235 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (25725 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 71 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 94 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   5 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   7 nodes to be scored    (3854 eliminated genes)
## 
##   Level 6:   15 nodes to be scored   (4998 eliminated genes)
## 
##   Level 5:   20 nodes to be scored   (5981 eliminated genes)
## 
##   Level 4:   19 nodes to be scored   (8169 eliminated genes)
## 
##   Level 3:   15 nodes to be scored   (12994 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (14620 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (24381 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 94 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 12 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   1 nodes to be scored    (170 eliminated genes)
## 
##   Level 5:   1 nodes to be scored    (260 eliminated genes)
## 
##   Level 4:   2 nodes to be scored    (627 eliminated genes)
## 
##   Level 3:   3 nodes to be scored    (1674 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (3535 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9420 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 12 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## Warning in arrows(head_from[1], head_from[2], head_to[1], head_to[2], col =
## edgeColor, : zero-length arrow is of indeterminate angle and so skipped

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 18 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   3 nodes to be scored    (170 eliminated genes)
## 
##   Level 5:   2 nodes to be scored    (308 eliminated genes)
## 
##   Level 4:   4 nodes to be scored    (2012 eliminated genes)
## 
##   Level 3:   3 nodes to be scored    (3534 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4148 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9420 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 18 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 92 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   6 nodes to be scored    (22 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (64 eliminated genes)
## 
##   Level 7:   13 nodes to be scored   (1827 eliminated genes)
## 
##   Level 6:   15 nodes to be scored   (2351 eliminated genes)
## 
##   Level 5:   18 nodes to be scored   (4745 eliminated genes)
## 
##   Level 4:   16 nodes to be scored   (7372 eliminated genes)
## 
##   Level 3:   9 nodes to be scored    (11030 eliminated genes)
## 
##   Level 2:   4 nodes to be scored    (14312 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (14896 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 92 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 105 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   9 nodes to be scored    (47 eliminated genes)
## 
##   Level 8:   10 nodes to be scored   (513 eliminated genes)
## 
##   Level 7:   11 nodes to be scored   (2167 eliminated genes)
## 
##   Level 6:   15 nodes to be scored   (2648 eliminated genes)
## 
##   Level 5:   19 nodes to be scored   (3593 eliminated genes)
## 
##   Level 4:   15 nodes to be scored   (5897 eliminated genes)
## 
##   Level 3:   15 nodes to be scored   (14223 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (16391 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18644 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 105 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 63 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   5 nodes to be scored    (3268 eliminated genes)
## 
##   Level 6:   9 nodes to be scored    (3318 eliminated genes)
## 
##   Level 5:   13 nodes to be scored   (4075 eliminated genes)
## 
##   Level 4:   15 nodes to be scored   (4305 eliminated genes)
## 
##   Level 3:   11 nodes to be scored   (9590 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (13844 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23430 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 63 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 44 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   6 nodes to be scored    (16 eliminated genes)
## 
##   Level 5:   9 nodes to be scored    (16 eliminated genes)
## 
##   Level 4:   9 nodes to be scored    (1014 eliminated genes)
## 
##   Level 3:   11 nodes to be scored   (4984 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (6464 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (23228 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 44 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 9 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 6:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 5:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 4:   2 nodes to be scored    (1337 eliminated genes)
## 
##   Level 3:   3 nodes to be scored    (2126 eliminated genes)
## 
##   Level 2:   1 nodes to be scored    (3564 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (4496 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 9 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 5 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 4:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 3:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 2:   1 nodes to be scored    (549 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (5756 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 5 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 126 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  5 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   10 nodes to be scored   (22 eliminated genes)
## 
##   Level 8:   15 nodes to be scored   (78 eliminated genes)
## 
##   Level 7:   19 nodes to be scored   (2306 eliminated genes)
## 
##   Level 6:   16 nodes to be scored   (4095 eliminated genes)
## 
##   Level 5:   22 nodes to be scored   (7006 eliminated genes)
## 
##   Level 4:   17 nodes to be scored   (8983 eliminated genes)
## 
##   Level 3:   14 nodes to be scored   (15235 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (17025 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18559 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 126 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 52 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   5 nodes to be scored    (341 eliminated genes)
## 
##   Level 7:   7 nodes to be scored    (1960 eliminated genes)
## 
##   Level 6:   7 nodes to be scored    (2356 eliminated genes)
## 
##   Level 5:   10 nodes to be scored   (3934 eliminated genes)
## 
##   Level 4:   7 nodes to be scored    (5096 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (7973 eliminated genes)
## 
##   Level 2:   3 nodes to be scored    (12800 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (14854 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 52 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 135 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   9 nodes to be scored    (78 eliminated genes)
## 
##   Level 7:   16 nodes to be scored   (3500 eliminated genes)
## 
##   Level 6:   26 nodes to be scored   (4997 eliminated genes)
## 
##   Level 5:   30 nodes to be scored   (6820 eliminated genes)
## 
##   Level 4:   25 nodes to be scored   (9636 eliminated genes)
## 
##   Level 3:   15 nodes to be scored   (15707 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (17876 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (26575 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 135 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 80 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   5 nodes to be scored    (40 eliminated genes)
## 
##   Level 7:   8 nodes to be scored    (3310 eliminated genes)
## 
##   Level 6:   13 nodes to be scored   (4547 eliminated genes)
## 
##   Level 5:   15 nodes to be scored   (6068 eliminated genes)
## 
##   Level 4:   16 nodes to be scored   (8635 eliminated genes)
## 
##   Level 3:   12 nodes to be scored   (12865 eliminated genes)
## 
##   Level 2:   7 nodes to be scored    (15023 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (25210 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 80 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 31 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   4 nodes to be scored    (104 eliminated genes)
## 
##   Level 6:   4 nodes to be scored    (310 eliminated genes)
## 
##   Level 5:   4 nodes to be scored    (669 eliminated genes)
## 
##   Level 4:   6 nodes to be scored    (1394 eliminated genes)
## 
##   Level 3:   5 nodes to be scored    (3794 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4768 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9434 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 31 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 20 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   3 nodes to be scored    (66 eliminated genes)
## 
##   Level 5:   3 nodes to be scored    (286 eliminated genes)
## 
##   Level 4:   5 nodes to be scored    (1585 eliminated genes)
## 
##   Level 3:   4 nodes to be scored    (3540 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4252 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (4562 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 20 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 311 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  5 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  20 nodes to be scored   (79 eliminated genes)
## 
##   Level 9:   24 nodes to be scored   (125 eliminated genes)
## 
##   Level 8:   39 nodes to be scored   (538 eliminated genes)
## 
##   Level 7:   52 nodes to be scored   (3021 eliminated genes)
## 
##   Level 6:   44 nodes to be scored   (4604 eliminated genes)
## 
##   Level 5:   53 nodes to be scored   (8935 eliminated genes)
## 
##   Level 4:   39 nodes to be scored   (11122 eliminated genes)
## 
##   Level 3:   25 nodes to be scored   (15914 eliminated genes)
## 
##   Level 2:   7 nodes to be scored    (18281 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18808 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 311 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 315 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 14:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 13:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  4 nodes to be scored    (117 eliminated genes)
## 
##   Level 11:  6 nodes to be scored    (131 eliminated genes)
## 
##   Level 10:  14 nodes to be scored   (135 eliminated genes)
## 
##   Level 9:   22 nodes to be scored   (191 eliminated genes)
## 
##   Level 8:   40 nodes to be scored   (331 eliminated genes)
## 
##   Level 7:   48 nodes to be scored   (3061 eliminated genes)
## 
##   Level 6:   45 nodes to be scored   (5746 eliminated genes)
## 
##   Level 5:   57 nodes to be scored   (9181 eliminated genes)
## 
##   Level 4:   37 nodes to be scored   (11862 eliminated genes)
## 
##   Level 3:   28 nodes to be scored   (16526 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (18170 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18694 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 315 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 282 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   5 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   12 nodes to be scored   (14 eliminated genes)
## 
##   Level 7:   38 nodes to be scored   (3948 eliminated genes)
## 
##   Level 6:   59 nodes to be scored   (6030 eliminated genes)
## 
##   Level 5:   69 nodes to be scored   (7878 eliminated genes)
## 
##   Level 4:   54 nodes to be scored   (10572 eliminated genes)
## 
##   Level 3:   28 nodes to be scored   (17385 eliminated genes)
## 
##   Level 2:   15 nodes to be scored   (20641 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27660 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 282 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## Warning in arrows(head_from[1], head_from[2], head_to[1], head_to[2], col =
## edgeColor, : zero-length arrow is of indeterminate angle and so skipped

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 267 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   10 nodes to be scored   (22 eliminated genes)
## 
##   Level 8:   17 nodes to be scored   (214 eliminated genes)
## 
##   Level 7:   32 nodes to be scored   (4335 eliminated genes)
## 
##   Level 6:   55 nodes to be scored   (6399 eliminated genes)
## 
##   Level 5:   59 nodes to be scored   (8030 eliminated genes)
## 
##   Level 4:   51 nodes to be scored   (11752 eliminated genes)
## 
##   Level 3:   25 nodes to be scored   (17542 eliminated genes)
## 
##   Level 2:   13 nodes to be scored   (19531 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (28045 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 267 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 76 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   10 nodes to be scored   (106 eliminated genes)
## 
##   Level 7:   10 nodes to be scored   (154 eliminated genes)
## 
##   Level 6:   12 nodes to be scored   (654 eliminated genes)
## 
##   Level 5:   9 nodes to be scored    (1529 eliminated genes)
## 
##   Level 4:   11 nodes to be scored   (3255 eliminated genes)
## 
##   Level 3:   13 nodes to be scored   (3818 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4608 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (10032 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 76 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 42 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   4 nodes to be scored    (114 eliminated genes)
## 
##   Level 6:   7 nodes to be scored    (180 eliminated genes)
## 
##   Level 5:   6 nodes to be scored    (859 eliminated genes)
## 
##   Level 4:   8 nodes to be scored    (2988 eliminated genes)
## 
##   Level 3:   9 nodes to be scored    (3889 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4872 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (10032 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 42 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 314 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 14:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 13:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  2 nodes to be scored    (117 eliminated genes)
## 
##   Level 11:  6 nodes to be scored    (117 eliminated genes)
## 
##   Level 10:  17 nodes to be scored   (117 eliminated genes)
## 
##   Level 9:   23 nodes to be scored   (306 eliminated genes)
## 
##   Level 8:   33 nodes to be scored   (809 eliminated genes)
## 
##   Level 7:   47 nodes to be scored   (3331 eliminated genes)
## 
##   Level 6:   44 nodes to be scored   (5229 eliminated genes)
## 
##   Level 5:   56 nodes to be scored   (8974 eliminated genes)
## 
##   Level 4:   40 nodes to be scored   (11408 eliminated genes)
## 
##   Level 3:   33 nodes to be scored   (15834 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (18021 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18995 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 314 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 159 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  1 nodes to be scored    (14 eliminated genes)
## 
##   Level 10:  3 nodes to be scored    (18 eliminated genes)
## 
##   Level 9:   5 nodes to be scored    (18 eliminated genes)
## 
##   Level 8:   15 nodes to be scored   (385 eliminated genes)
## 
##   Level 7:   25 nodes to be scored   (1884 eliminated genes)
## 
##   Level 6:   31 nodes to be scored   (3323 eliminated genes)
## 
##   Level 5:   32 nodes to be scored   (5836 eliminated genes)
## 
##   Level 4:   22 nodes to be scored   (9931 eliminated genes)
## 
##   Level 3:   16 nodes to be scored   (15972 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (18028 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18713 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 159 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 225 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   9 nodes to be scored    (22 eliminated genes)
## 
##   Level 8:   17 nodes to be scored   (200 eliminated genes)
## 
##   Level 7:   33 nodes to be scored   (4286 eliminated genes)
## 
##   Level 6:   44 nodes to be scored   (6547 eliminated genes)
## 
##   Level 5:   47 nodes to be scored   (7894 eliminated genes)
## 
##   Level 4:   39 nodes to be scored   (10910 eliminated genes)
## 
##   Level 3:   21 nodes to be scored   (17663 eliminated genes)
## 
##   Level 2:   11 nodes to be scored   (19909 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27306 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 225 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 148 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   10 nodes to be scored   (152 eliminated genes)
## 
##   Level 7:   19 nodes to be scored   (3735 eliminated genes)
## 
##   Level 6:   24 nodes to be scored   (5232 eliminated genes)
## 
##   Level 5:   28 nodes to be scored   (7569 eliminated genes)
## 
##   Level 4:   29 nodes to be scored   (9377 eliminated genes)
## 
##   Level 3:   18 nodes to be scored   (16130 eliminated genes)
## 
##   Level 2:   10 nodes to be scored   (18596 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (26769 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 148 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 61 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   5 nodes to be scored    (6 eliminated genes)
## 
##   Level 8:   7 nodes to be scored    (62 eliminated genes)
## 
##   Level 7:   8 nodes to be scored    (186 eliminated genes)
## 
##   Level 6:   7 nodes to be scored    (442 eliminated genes)
## 
##   Level 5:   8 nodes to be scored    (891 eliminated genes)
## 
##   Level 4:   10 nodes to be scored   (2463 eliminated genes)
## 
##   Level 3:   10 nodes to be scored   (3874 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4897 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9957 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 61 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 35 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   6 nodes to be scored    (350 eliminated genes)
## 
##   Level 5:   4 nodes to be scored    (978 eliminated genes)
## 
##   Level 4:   6 nodes to be scored    (2578 eliminated genes)
## 
##   Level 3:   9 nodes to be scored    (3540 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4691 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9987 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 35 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 289 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  14 nodes to be scored   (0 eliminated genes)
## 
##   Level 9:   20 nodes to be scored   (91 eliminated genes)
## 
##   Level 8:   31 nodes to be scored   (631 eliminated genes)
## 
##   Level 7:   43 nodes to be scored   (2926 eliminated genes)
## 
##   Level 6:   41 nodes to be scored   (4425 eliminated genes)
## 
##   Level 5:   55 nodes to be scored   (7891 eliminated genes)
## 
##   Level 4:   41 nodes to be scored   (10793 eliminated genes)
## 
##   Level 3:   31 nodes to be scored   (16514 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (18414 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (19018 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 289 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 343 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  7 nodes to be scored    (48 eliminated genes)
## 
##   Level 10:  14 nodes to be scored   (113 eliminated genes)
## 
##   Level 9:   25 nodes to be scored   (144 eliminated genes)
## 
##   Level 8:   42 nodes to be scored   (551 eliminated genes)
## 
##   Level 7:   58 nodes to be scored   (2907 eliminated genes)
## 
##   Level 6:   52 nodes to be scored   (5200 eliminated genes)
## 
##   Level 5:   57 nodes to be scored   (9430 eliminated genes)
## 
##   Level 4:   43 nodes to be scored   (11947 eliminated genes)
## 
##   Level 3:   30 nodes to be scored   (16823 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (18460 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18949 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 343 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 237 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   11 nodes to be scored   (0 eliminated genes)
## 
##   Level 7:   27 nodes to be scored   (3853 eliminated genes)
## 
##   Level 6:   52 nodes to be scored   (5850 eliminated genes)
## 
##   Level 5:   59 nodes to be scored   (7511 eliminated genes)
## 
##   Level 4:   42 nodes to be scored   (10595 eliminated genes)
## 
##   Level 3:   28 nodes to be scored   (17236 eliminated genes)
## 
##   Level 2:   14 nodes to be scored   (19418 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27778 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 237 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 252 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   7 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   17 nodes to be scored   (0 eliminated genes)
## 
##   Level 7:   31 nodes to be scored   (4069 eliminated genes)
## 
##   Level 6:   51 nodes to be scored   (6272 eliminated genes)
## 
##   Level 5:   58 nodes to be scored   (8136 eliminated genes)
## 
##   Level 4:   48 nodes to be scored   (11506 eliminated genes)
## 
##   Level 3:   26 nodes to be scored   (17884 eliminated genes)
## 
##   Level 2:   13 nodes to be scored   (19773 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27878 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 252 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 49 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (68 eliminated genes)
## 
##   Level 7:   6 nodes to be scored    (124 eliminated genes)
## 
##   Level 6:   6 nodes to be scored    (435 eliminated genes)
## 
##   Level 5:   5 nodes to be scored    (1072 eliminated genes)
## 
##   Level 4:   8 nodes to be scored    (2767 eliminated genes)
## 
##   Level 3:   10 nodes to be scored   (3564 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4783 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (10032 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 49 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 49 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   6 nodes to be scored    (22 eliminated genes)
## 
##   Level 6:   9 nodes to be scored    (215 eliminated genes)
## 
##   Level 5:   7 nodes to be scored    (602 eliminated genes)
## 
##   Level 4:   8 nodes to be scored    (3043 eliminated genes)
## 
##   Level 3:   11 nodes to be scored   (3875 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4916 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (10032 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 49 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 226 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  4 nodes to be scored    (8 eliminated genes)
## 
##   Level 10:  15 nodes to be scored   (12 eliminated genes)
## 
##   Level 9:   17 nodes to be scored   (48 eliminated genes)
## 
##   Level 8:   23 nodes to be scored   (556 eliminated genes)
## 
##   Level 7:   34 nodes to be scored   (2632 eliminated genes)
## 
##   Level 6:   33 nodes to be scored   (3646 eliminated genes)
## 
##   Level 5:   42 nodes to be scored   (7256 eliminated genes)
## 
##   Level 4:   30 nodes to be scored   (9459 eliminated genes)
## 
##   Level 3:   20 nodes to be scored   (15390 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (17954 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18644 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 226 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 206 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 14:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 13:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  2 nodes to be scored    (117 eliminated genes)
## 
##   Level 11:  4 nodes to be scored    (117 eliminated genes)
## 
##   Level 10:  8 nodes to be scored    (117 eliminated genes)
## 
##   Level 9:   13 nodes to be scored   (186 eliminated genes)
## 
##   Level 8:   21 nodes to be scored   (691 eliminated genes)
## 
##   Level 7:   30 nodes to be scored   (2717 eliminated genes)
## 
##   Level 6:   29 nodes to be scored   (3740 eliminated genes)
## 
##   Level 5:   34 nodes to be scored   (7482 eliminated genes)
## 
##   Level 4:   30 nodes to be scored   (9886 eliminated genes)
## 
##   Level 3:   23 nodes to be scored   (16111 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (17879 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18790 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 206 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 193 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   9 nodes to be scored    (40 eliminated genes)
## 
##   Level 7:   23 nodes to be scored   (3320 eliminated genes)
## 
##   Level 6:   37 nodes to be scored   (5317 eliminated genes)
## 
##   Level 5:   45 nodes to be scored   (7419 eliminated genes)
## 
##   Level 4:   44 nodes to be scored   (10365 eliminated genes)
## 
##   Level 3:   20 nodes to be scored   (16885 eliminated genes)
## 
##   Level 2:   10 nodes to be scored   (19825 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27146 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 193 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 179 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   5 nodes to be scored    (74 eliminated genes)
## 
##   Level 8:   13 nodes to be scored   (306 eliminated genes)
## 
##   Level 7:   16 nodes to be scored   (4246 eliminated genes)
## 
##   Level 6:   28 nodes to be scored   (6188 eliminated genes)
## 
##   Level 5:   39 nodes to be scored   (7386 eliminated genes)
## 
##   Level 4:   41 nodes to be scored   (9498 eliminated genes)
## 
##   Level 3:   22 nodes to be scored   (15571 eliminated genes)
## 
##   Level 2:   10 nodes to be scored   (18761 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27303 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 179 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 46 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   7 nodes to be scored    (56 eliminated genes)
## 
##   Level 7:   5 nodes to be scored    (72 eliminated genes)
## 
##   Level 6:   5 nodes to be scored    (386 eliminated genes)
## 
##   Level 5:   6 nodes to be scored    (734 eliminated genes)
## 
##   Level 4:   8 nodes to be scored    (2212 eliminated genes)
## 
##   Level 3:   9 nodes to be scored    (3586 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4279 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9957 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 46 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 35 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   4 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   5 nodes to be scored    (108 eliminated genes)
## 
##   Level 6:   5 nodes to be scored    (398 eliminated genes)
## 
##   Level 5:   4 nodes to be scored    (781 eliminated genes)
## 
##   Level 4:   6 nodes to be scored    (2427 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (3794 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4768 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9434 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 35 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 341 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  7 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  24 nodes to be scored   (84 eliminated genes)
## 
##   Level 9:   29 nodes to be scored   (148 eliminated genes)
## 
##   Level 8:   42 nodes to be scored   (937 eliminated genes)
## 
##   Level 7:   51 nodes to be scored   (2967 eliminated genes)
## 
##   Level 6:   44 nodes to be scored   (4569 eliminated genes)
## 
##   Level 5:   57 nodes to be scored   (7322 eliminated genes)
## 
##   Level 4:   43 nodes to be scored   (8906 eliminated genes)
## 
##   Level 3:   31 nodes to be scored   (16664 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (18379 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18969 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 341 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 435 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 13:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  6 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  11 nodes to be scored   (56 eliminated genes)
## 
##   Level 10:  33 nodes to be scored   (207 eliminated genes)
## 
##   Level 9:   44 nodes to be scored   (258 eliminated genes)
## 
##   Level 8:   58 nodes to be scored   (750 eliminated genes)
## 
##   Level 7:   68 nodes to be scored   (3199 eliminated genes)
## 
##   Level 6:   59 nodes to be scored   (5273 eliminated genes)
## 
##   Level 5:   66 nodes to be scored   (9101 eliminated genes)
## 
##   Level 4:   47 nodes to be scored   (10845 eliminated genes)
## 
##   Level 3:   31 nodes to be scored   (16620 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (18355 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18842 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 435 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 254 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (74 eliminated genes)
## 
##   Level 8:   17 nodes to be scored   (184 eliminated genes)
## 
##   Level 7:   26 nodes to be scored   (4291 eliminated genes)
## 
##   Level 6:   46 nodes to be scored   (6504 eliminated genes)
## 
##   Level 5:   59 nodes to be scored   (8195 eliminated genes)
## 
##   Level 4:   55 nodes to be scored   (10897 eliminated genes)
## 
##   Level 3:   27 nodes to be scored   (17205 eliminated genes)
## 
##   Level 2:   13 nodes to be scored   (19826 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27711 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 254 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 297 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   9 nodes to be scored    (22 eliminated genes)
## 
##   Level 8:   19 nodes to be scored   (162 eliminated genes)
## 
##   Level 7:   42 nodes to be scored   (4347 eliminated genes)
## 
##   Level 6:   61 nodes to be scored   (6533 eliminated genes)
## 
##   Level 5:   67 nodes to be scored   (8302 eliminated genes)
## 
##   Level 4:   54 nodes to be scored   (11643 eliminated genes)
## 
##   Level 3:   26 nodes to be scored   (18048 eliminated genes)
## 
##   Level 2:   15 nodes to be scored   (20347 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (28047 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 297 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 47 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   6 nodes to be scored    (121 eliminated genes)
## 
##   Level 6:   8 nodes to be scored    (503 eliminated genes)
## 
##   Level 5:   5 nodes to be scored    (873 eliminated genes)
## 
##   Level 4:   6 nodes to be scored    (3061 eliminated genes)
## 
##   Level 3:   10 nodes to be scored   (3802 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4768 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9956 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 47 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 74 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   12 nodes to be scored   (0 eliminated genes)
## 
##   Level 7:   12 nodes to be scored   (48 eliminated genes)
## 
##   Level 6:   12 nodes to be scored   (532 eliminated genes)
## 
##   Level 5:   11 nodes to be scored   (1198 eliminated genes)
## 
##   Level 4:   9 nodes to be scored    (3395 eliminated genes)
## 
##   Level 3:   12 nodes to be scored   (3917 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4916 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (10032 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 74 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 287 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  5 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  15 nodes to be scored   (79 eliminated genes)
## 
##   Level 9:   22 nodes to be scored   (137 eliminated genes)
## 
##   Level 8:   38 nodes to be scored   (481 eliminated genes)
## 
##   Level 7:   43 nodes to be scored   (2774 eliminated genes)
## 
##   Level 6:   40 nodes to be scored   (4652 eliminated genes)
## 
##   Level 5:   50 nodes to be scored   (8422 eliminated genes)
## 
##   Level 4:   38 nodes to be scored   (11193 eliminated genes)
## 
##   Level 3:   26 nodes to be scored   (16291 eliminated genes)
## 
##   Level 2:   7 nodes to be scored    (18402 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18821 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 287 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 366 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 14:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 13:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 12:  3 nodes to be scored    (117 eliminated genes)
## 
##   Level 11:  6 nodes to be scored    (117 eliminated genes)
## 
##   Level 10:  19 nodes to be scored   (199 eliminated genes)
## 
##   Level 9:   29 nodes to be scored   (255 eliminated genes)
## 
##   Level 8:   52 nodes to be scored   (521 eliminated genes)
## 
##   Level 7:   56 nodes to be scored   (3205 eliminated genes)
## 
##   Level 6:   51 nodes to be scored   (5602 eliminated genes)
## 
##   Level 5:   61 nodes to be scored   (8703 eliminated genes)
## 
##   Level 4:   44 nodes to be scored   (10910 eliminated genes)
## 
##   Level 3:   33 nodes to be scored   (16771 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (18411 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (19037 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 366 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 233 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   16 nodes to be scored   (0 eliminated genes)
## 
##   Level 7:   27 nodes to be scored   (4057 eliminated genes)
## 
##   Level 6:   46 nodes to be scored   (6293 eliminated genes)
## 
##   Level 5:   53 nodes to be scored   (7523 eliminated genes)
## 
##   Level 4:   47 nodes to be scored   (10959 eliminated genes)
## 
##   Level 3:   24 nodes to be scored   (17560 eliminated genes)
## 
##   Level 2:   13 nodes to be scored   (19817 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27318 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 233 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 256 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   7 nodes to be scored    (22 eliminated genes)
## 
##   Level 8:   18 nodes to be scored   (200 eliminated genes)
## 
##   Level 7:   35 nodes to be scored   (4142 eliminated genes)
## 
##   Level 6:   48 nodes to be scored   (6392 eliminated genes)
## 
##   Level 5:   62 nodes to be scored   (7572 eliminated genes)
## 
##   Level 4:   47 nodes to be scored   (11333 eliminated genes)
## 
##   Level 3:   22 nodes to be scored   (17814 eliminated genes)
## 
##   Level 2:   13 nodes to be scored   (19377 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (28027 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 256 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 49 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   5 nodes to be scored    (105 eliminated genes)
## 
##   Level 6:   8 nodes to be scored    (345 eliminated genes)
## 
##   Level 5:   6 nodes to be scored    (755 eliminated genes)
## 
##   Level 4:   7 nodes to be scored    (3013 eliminated genes)
## 
##   Level 3:   11 nodes to be scored   (3802 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4768 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9956 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 49 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 54 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   8 nodes to be scored    (114 eliminated genes)
## 
##   Level 6:   8 nodes to be scored    (323 eliminated genes)
## 
##   Level 5:   8 nodes to be scored    (1052 eliminated genes)
## 
##   Level 4:   9 nodes to be scored    (3197 eliminated genes)
## 
##   Level 3:   9 nodes to be scored    (3933 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4916 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9765 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 54 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 182 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  4 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   10 nodes to be scored   (24 eliminated genes)
## 
##   Level 8:   18 nodes to be scored   (116 eliminated genes)
## 
##   Level 7:   28 nodes to be scored   (1981 eliminated genes)
## 
##   Level 6:   28 nodes to be scored   (3500 eliminated genes)
## 
##   Level 5:   35 nodes to be scored   (5836 eliminated genes)
## 
##   Level 4:   28 nodes to be scored   (7698 eliminated genes)
## 
##   Level 3:   22 nodes to be scored   (14982 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (18043 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18756 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 182 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 238 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  2 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  10 nodes to be scored   (82 eliminated genes)
## 
##   Level 9:   20 nodes to be scored   (129 eliminated genes)
## 
##   Level 8:   30 nodes to be scored   (354 eliminated genes)
## 
##   Level 7:   34 nodes to be scored   (2227 eliminated genes)
## 
##   Level 6:   34 nodes to be scored   (4033 eliminated genes)
## 
##   Level 5:   39 nodes to be scored   (6734 eliminated genes)
## 
##   Level 4:   36 nodes to be scored   (9973 eliminated genes)
## 
##   Level 3:   25 nodes to be scored   (16257 eliminated genes)
## 
##   Level 2:   6 nodes to be scored    (18314 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18871 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 238 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 171 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   10 nodes to be scored   (40 eliminated genes)
## 
##   Level 7:   15 nodes to be scored   (3862 eliminated genes)
## 
##   Level 6:   31 nodes to be scored   (5962 eliminated genes)
## 
##   Level 5:   40 nodes to be scored   (7281 eliminated genes)
## 
##   Level 4:   42 nodes to be scored   (9600 eliminated genes)
## 
##   Level 3:   19 nodes to be scored   (15711 eliminated genes)
## 
##   Level 2:   9 nodes to be scored    (19239 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27357 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 171 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 157 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   14 nodes to be scored   (3268 eliminated genes)
## 
##   Level 6:   28 nodes to be scored   (3965 eliminated genes)
## 
##   Level 5:   39 nodes to be scored   (6791 eliminated genes)
## 
##   Level 4:   37 nodes to be scored   (9670 eliminated genes)
## 
##   Level 3:   21 nodes to be scored   (16268 eliminated genes)
## 
##   Level 2:   10 nodes to be scored   (18466 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27442 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 157 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 25 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   4 nodes to be scored    (78 eliminated genes)
## 
##   Level 5:   3 nodes to be scored    (546 eliminated genes)
## 
##   Level 4:   5 nodes to be scored    (2212 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (3540 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4252 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9943 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 25 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 24 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   1 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   3 nodes to be scored    (170 eliminated genes)
## 
##   Level 5:   3 nodes to be scored    (313 eliminated genes)
## 
##   Level 4:   5 nodes to be scored    (726 eliminated genes)
## 
##   Level 3:   6 nodes to be scored    (1825 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4245 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9690 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 24 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1016 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 2409 GO terms and 4679 relations. )
## 
## Annotating nodes ...............
##  ( 19139 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 247 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 11:  3 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  9 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   16 nodes to be scored   (151 eliminated genes)
## 
##   Level 8:   29 nodes to be scored   (313 eliminated genes)
## 
##   Level 7:   40 nodes to be scored   (2522 eliminated genes)
## 
##   Level 6:   38 nodes to be scored   (3849 eliminated genes)
## 
##   Level 5:   44 nodes to be scored   (6866 eliminated genes)
## 
##   Level 4:   32 nodes to be scored   (8581 eliminated genes)
## 
##   Level 3:   27 nodes to be scored   (16019 eliminated genes)
## 
##   Level 2:   8 nodes to be scored    (18122 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18811 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 247 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 211 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 12:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 11:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 10:  9 nodes to be scored    (82 eliminated genes)
## 
##   Level 9:   16 nodes to be scored   (82 eliminated genes)
## 
##   Level 8:   26 nodes to be scored   (565 eliminated genes)
## 
##   Level 7:   34 nodes to be scored   (2412 eliminated genes)
## 
##   Level 6:   30 nodes to be scored   (4072 eliminated genes)
## 
##   Level 5:   35 nodes to be scored   (7554 eliminated genes)
## 
##   Level 4:   32 nodes to be scored   (9107 eliminated genes)
## 
##   Level 3:   21 nodes to be scored   (14716 eliminated genes)
## 
##   Level 2:   5 nodes to be scored    (18274 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (18752 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 211 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 1187 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 1615 GO terms and 2106 relations. )
## 
## Annotating nodes ...............
##  ( 28500 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 194 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 10:  1 nodes to be scored    (0 eliminated genes)
## 
##   Level 9:   6 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   15 nodes to be scored   (78 eliminated genes)
## 
##   Level 7:   25 nodes to be scored   (4076 eliminated genes)
## 
##   Level 6:   34 nodes to be scored   (6457 eliminated genes)
## 
##   Level 5:   43 nodes to be scored   (8023 eliminated genes)
## 
##   Level 4:   38 nodes to be scored   (10603 eliminated genes)
## 
##   Level 3:   21 nodes to be scored   (17034 eliminated genes)
## 
##   Level 2:   10 nodes to be scored   (19446 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27263 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 194 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 168 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   2 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   8 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   17 nodes to be scored   (3820 eliminated genes)
## 
##   Level 6:   31 nodes to be scored   (5677 eliminated genes)
## 
##   Level 5:   42 nodes to be scored   (6902 eliminated genes)
## 
##   Level 4:   38 nodes to be scored   (10148 eliminated genes)
## 
##   Level 3:   18 nodes to be scored   (15850 eliminated genes)
## 
##   Level 2:   11 nodes to be scored   (18728 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (27026 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 168 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
## Building most specific GOs .....
##  ( 337 GO terms found. )
## 
## Build GO DAG topology ..........
##  ( 554 GO terms and 952 relations. )
## 
## Annotating nodes ...............
##  ( 10145 genes annotated to the GO terms. )
## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 43 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 9:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 8:   5 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   5 nodes to be scored    (166 eliminated genes)
## 
##   Level 6:   6 nodes to be scored    (402 eliminated genes)
## 
##   Level 5:   6 nodes to be scored    (673 eliminated genes)
## 
##   Level 4:   7 nodes to be scored    (2731 eliminated genes)
## 
##   Level 3:   8 nodes to be scored    (3824 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4768 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9881 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 43 nontrivial nodes
##       parameters: 
##           test statistic: fisher

## 
##           -- Weight01 Algorithm -- 
## 
##       the algorithm is scoring 36 nontrivial nodes
##       parameters: 
##           test statistic: fisher
## 
##   Level 8:   3 nodes to be scored    (0 eliminated genes)
## 
##   Level 7:   5 nodes to be scored    (0 eliminated genes)
## 
##   Level 6:   6 nodes to be scored    (334 eliminated genes)
## 
##   Level 5:   5 nodes to be scored    (665 eliminated genes)
## 
##   Level 4:   6 nodes to be scored    (2478 eliminated genes)
## 
##   Level 3:   8 nodes to be scored    (3647 eliminated genes)
## 
##   Level 2:   2 nodes to be scored    (4296 eliminated genes)
## 
##   Level 1:   1 nodes to be scored    (9943 eliminated genes)
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 36 nontrivial nodes
##       parameters: 
##           test statistic: fisher

3 ClusterProfiler analysis

3.1 Plant

3.1.1 Import des données pour l’analyse TopGO sur les échantillons issus des plantes

# Définir la liste des conditions d’intérêt
select_cond <- c(
  "P_t1_Q11L, P_t1_Q11V_L",
  "P_t1_Q21L, P_t1_Q21V_L",
  "P_t2_Q11L, P_t2_Q11V_L",
  "P_t2_Q21L, P_t2_Q21V_L",
  "P_t1_Q11V_L, P_t2_Q11V_L",
  "P_t1_Q21V_L, P_t2_Q21V_L",
  "P_t1_Q11L, P_t2_Q11L",
  "P_t1_Q21L, P_t2_Q21L",
  "P_t1_Q11L, P_t1_Q21L",
  "P_t1_Q11V_L, P_t1_Q21V_L",
  "P_t2_Q11L, P_t2_Q21L",
  "P_t2_Q11V_L, P_t2_Q21V_L"
)

# Lire les lignes du fichier contenant les chemins et infos 
lines_raw <- readLines("TopGO/Plant/liste_deseq.txt")
## Warning in readLines("TopGO/Plant/liste_deseq.txt"): ligne finale incomplète
## trouvée dans 'TopGO/Plant/liste_deseq.txt'
# Initialiser une liste de résultats 
chemins_trouves <- data.frame(ID1 = character(),
                              ID2 = character(),
                              chemin = character(),
                              info = character(),
                              stringsAsFactors = FALSE)

# Recherche des lignes correspondantes à chaque couple
for (cond in select_cond) {
  ids <- str_split(cond, ",\\s*")[[1]]
  id1 <- ids[1]
  id2 <- ids[2]
  
  # Match la ligne contenant les deux identifiants dans le nom du fichier
  match_lines <- lines_raw[str_detect(lines_raw, fixed(id1)) & 
                             str_detect(lines_raw, fixed(id2))]
  
  for (line in match_lines) {
    # Séparer le chemin et l'info
    parts <- str_split(line, ",\\s*")[[1]]
    chemin <- parts[1]
    info <- ifelse(length(parts) > 1, parts[2], NA)

    if (!is.na(chemin) && file.exists(chemin)) {
      chemins_trouves <- rbind(
        chemins_trouves,
        data.frame(ID1 = id1, ID2 = id2, chemin = chemin, info = info, 
                   stringsAsFactors = FALSE)
      )
    } else {
      warning(paste("Fichier introuvable ou chemin invalide:", chemin))
    }
  }
}

# Importer et annoter les tableaux
list_tables <- list()

for (i in 1:nrow(chemins_trouves)) {
  path <- chemins_trouves$chemin[i]
  id_label <- paste(chemins_trouves$ID1[i], chemins_trouves$ID2[i], 
                    sep = "_VS_")
  info_val <- chemins_trouves$info[i]

  df <- tryCatch({
    read_delim(path, delim = ",", show_col_types = FALSE)
  }, error = function(e) {
    warning(paste("Erreur lors de l'import:", path))
    return(NULL)
  })

  if (!is.null(df)) {
    df$ID <- id_label
    df$Info <- info_val
    df_2 <- subset(df,padj < 0.05 & abs(log2FoldChange) > 1 & padj != 0) 
    #use subset to filter dataframes by columns
    list_tables[[length(list_tables) + 1]] <- df_2
  }
}
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## • `` -> `...1`
# Fusionner tous les tableaux 
table_fusionnee <- bind_rows(list_tables)
colnames(table_fusionnee)[1] <- "gene_id"

# Aperçu ou sauvegarde
print(head(table_fusionnee))
## # A tibble: 6 × 9
##   gene_id     baseMean log2FoldChange lfcSE   stat   pvalue     padj ID    Info 
##   <chr>          <dbl>          <dbl> <dbl>  <dbl>    <dbl>    <dbl> <chr> <chr>
## 1 lcl|NC_090…    105.           -21.7  2.01 -10.8  4.38e-27 1.56e-22 P_t1… Plant
## 2 lcl|NC_090…     60.1           22.4  2.18  10.3  9.43e-25 1.69e-20 P_t1… Plant
## 3 lcl|NC_090…     51.3           23.3  2.44   9.53 1.60e-21 1.91e-17 P_t1… Plant
## 4 lcl|NC_090…     26.6          -18.9  2.10  -8.97 2.96e-19 2.64e-15 P_t1… Plant
## 5 lcl|NC_090…    196.            26.4  2.97   8.91 5.03e-19 3.59e-15 P_t1… Plant
## 6 lcl|NC_090…     23.2          -19.8  2.36  -8.39 5.02e-17 2.56e-13 P_t1… Plant
#write_csv(table_fusionnee, "TopGO/Plant/table_fusionnee.csv")

# Mapping gènes → KO
ko_map <- read.delim("TopGO/resultats_concat_final_kegg.tsv", header = TRUE)

table_fusionnee$KO <- NA
# Pour chaque ligne de ko_table, 
#on cherche l'identifiant dans les gene_id de deg_ko
for(i in seq_len(nrow(ko_map))) {
  pattern <- ko_map$gene_id[i]
  match_index <- str_detect(table_fusionnee$gene_id, fixed(pattern))  
  
  # Vérifier si on a trouvé une correspondance avant d'affecter une valeur
  if (any(match_index)) {
    table_fusionnee$KO[match_index] <- ko_map$ko[i]
  } 
}

3.1.2 Formalisations des données, tests et représentations graphiques

## Reading KEGG annotation online: "https://rest.kegg.jp/link/ko/pathway"...
## Reading KEGG annotation online: "https://rest.kegg.jp/list/pathway/ko"...

3.2 Insect

3.2.1 Import des données pour l’analyse TopGO sur les échantillons issus des plantes

# Définir la liste des conditions d’intérêt
select_cond=c("B_t1_Q11L, B_t1_Q11V_L", "B_t1_Q21L, B_t1_Q21V_L", "B_t2_Q11L,
              B_t2_Q11V_L", "B_t2_Q21L, B_t2_Q21V_L", "B_t1_Q11V_L, 
              B_t2_Q11V_L", "B_t1_Q21V_L, B_t2_Q21V_L", "B_t1_Q11L, B_t2_Q11L",
              "B_t1_Q21L, B_t2_Q21L", "B_t1_Q11L, B_t1_Q21L", "B_t1_Q11V_L,
              B_t1_Q21V_L", "B_t2_Q11L, B_t2_Q21L", "B_t2_Q11V_L, B_t2_Q21V_L")

# Lire les lignes du fichier contenant les chemins et infos 
lines_raw <- readLines("TopGO/Insect/liste_deseq.txt")

# Initialiser une liste de résultats 
chemins_trouves <- data.frame(ID1 = character(),
                              ID2 = character(),
                              chemin = character(),
                              info = character(),
                              stringsAsFactors = FALSE)

# Recherche des lignes correspondantes à chaque couple
for (cond in select_cond) {
  ids <- str_split(cond, ",\\s*")[[1]]
  id1 <- ids[1]
  id2 <- ids[2]
  
  # Match la ligne contenant les deux identifiants dans le nom du fichier
  match_lines <- lines_raw[str_detect(lines_raw, fixed(id1)) & 
                             str_detect(lines_raw, fixed(id2))]
  
  for (line in match_lines) {
    # Séparer le chemin et l'info
    parts <- str_split(line, ",\\s*")[[1]]
    chemin <- parts[1]
    info <- ifelse(length(parts) > 1, parts[2], NA)

    if (!is.na(chemin) && file.exists(chemin)) {
      chemins_trouves <- rbind(
        chemins_trouves,
        data.frame(ID1 = id1, ID2 = id2, chemin = chemin, info = info, 
                   stringsAsFactors = FALSE)
      )
    } else {
      warning(paste("Fichier introuvable ou chemin invalide:", chemin))
    }
  }
}

# Importer et annoter les tableaux
list_tables <- list()

for (i in 1:nrow(chemins_trouves)) {
  path <- chemins_trouves$chemin[i]
  id_label <- paste(chemins_trouves$ID1[i], chemins_trouves$ID2[i], 
                    sep = "_VS_")
  info_val <- chemins_trouves$info[i]

  df <- tryCatch({
    read_delim(path, delim = ",", show_col_types = FALSE)
  }, error = function(e) {
    warning(paste("Erreur lors de l'import:", path))
    return(NULL)
  })

  if (!is.null(df)) {
    df$ID <- id_label
    df$Info <- info_val
    df_2 <- subset(df,padj < 0.05 & abs(log2FoldChange) > 1 & padj != 0) 
    #use subset to filter dataframes by columns
    list_tables[[length(list_tables) + 1]] <- df_2
  }
}
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## New names:
## • `` -> `...1`
# Fusionner tous les tableaux 
table_fusionnee <- bind_rows(list_tables)
colnames(table_fusionnee)[1] <- "gene_id"

# Aperçu ou sauvegarde
print(head(table_fusionnee))
## # A tibble: 6 × 9
##   gene_id     baseMean log2FoldChange lfcSE   stat   pvalue     padj ID    Info 
##   <chr>          <dbl>          <dbl> <dbl>  <dbl>    <dbl>    <dbl> <chr> <chr>
## 1 lcl|NC_092…    134.           -20.7  1.54 -13.4  4.49e-41 1.03e-36 B_t1… Inse…
## 2 lcl|NC_092…     17.9          -18.3  2.04  -8.98 2.64e-19 3.04e-15 B_t1… Inse…
## 3 lcl|NC_092…     76.1          -19.2  2.30  -8.32 8.53e-17 6.55e-13 B_t1… Inse…
## 4 lcl|NC_092…     43.0           22.9  2.76   8.28 1.27e-16 7.30e-13 B_t1… Inse…
## 5 lcl|NC_092…     36.6          -20.2  2.59  -7.79 6.45e-15 2.97e-11 B_t1… Inse…
## 6 lcl|NC_092…     59.8           22.6  3.03   7.47 7.83e-14 3.01e-10 B_t1… Inse…
#write_csv(table_fusionnee, "TopGO/Insect/table_fusionnee.csv")

# Mapping gènes → KO
ko_map <- read.delim("TopGO/resultats_concat_final_kegg.tsv", header = TRUE)

table_fusionnee$KO <- NA
# Pour chaque ligne de ko_table, 
#on cherche l'identifiant dans les gene_id de deg_ko
for(i in seq_len(nrow(ko_map))) {
  pattern <- ko_map$gene_id[i]
  match_index <- str_detect(table_fusionnee$gene_id, fixed(pattern))  
  
  # Vérifier si on a trouvé une correspondance avant d'affecter une valeur
  if (any(match_index)) {
    table_fusionnee$KO[match_index] <- ko_map$ko[i]
  } 
}

3.2.2 Formalisations des données, tests et représentations graphiques

#UpSetR

##Plant

###Formalisation des données UpsetR

# Liste de comparaison
select_cond <- c("P_t1_Q11L, P_t1_Q11V_L", "P_t1_Q21L, P_t1_Q21V_L", "P_t2_Q11L,
                 P_t2_Q11V_L", "P_t2_Q21L, P_t2_Q21V_L", "P_t1_Q11V_L, 
                 P_t2_Q11V_L", "P_t1_Q21V_L, P_t2_Q21V_L", "P_t1_Q11L, 
                 P_t2_Q11L", "P_t1_Q21L, P_t2_Q21L", "P_t1_Q11L, P_t1_Q21L", 
                 "P_t1_Q11V_L, P_t1_Q21V_L", "P_t2_Q11L, P_t2_Q21L", 
                 "P_t2_Q11V_L, P_t2_Q21V_L")

list_sig_genes <- list()

for (i in seq_along(select_cond)) {
  ids <- strsplit(select_cond[i], ",\\s*")[[1]]
  ID1 <- ids[1]
  ID2 <- ids[2]
  
  res.F <- results(dds_tomato.deseq, contrast = c("condition", ID1, ID2))
  res.F$padj <- p.adjust(res.F$pvalue, method = "fdr")
  res.F <- res.F[order(res.F$padj), ]
  
  sig_genes_up <- rownames(res.F)[which(res.F$padj < 0.05 & res.F$log2FoldChange >= 1)]
  sig_genes_down <- rownames(res.F)[which(res.F$padj < 0.05 & res.F$log2FoldChange <= -1)]
  
  name_comp <- paste0(ID1, "_vs_", ID2)
  
  df_up <- data.frame(gene = sig_genes_up, direction = "up", stringsAsFactors = FALSE)
  df_down <- data.frame(gene = sig_genes_down, direction = "down", stringsAsFactors = FALSE)
  
  list_sig_genes[[name_comp]] <- rbind(df_up, df_down)
}

# Obtenir tous les gènes significatifs
all_genes <- unique(unlist(lapply(list_sig_genes, function(df) df$gene)))

# Créer le tableau final
upset_data <- data.frame(gene = all_genes, stringsAsFactors = FALSE)

# Ajouter les colonnes de comparaison (1/0) et direction (par majorité si unique)
for (comp in names(list_sig_genes)) {
  genes <- list_sig_genes[[comp]]
  upset_data[[comp]] <- as.integer(upset_data$gene %in% genes$gene)
}

# Direction principale : si un gène est up ou down plus souvent
direction_vector <- sapply(upset_data$gene, function(g) {
  dirs <- unlist(lapply(list_sig_genes, function(df) {
    if (g %in% df$gene) df$direction[df$gene == g] else NULL
  }))
  if (length(dirs) == 0) return(NA)
  if (sum(dirs == "up") >= sum(dirs == "down")) return("up") else return("down")
})

upset_data$direction <- factor(direction_vector, levels = c("up", "down"))

comparison_cols <- setdiff(colnames(upset_data), c("gene", "direction"))

###Représentation graphique

#pdf("upset_plante.pdf")
ComplexUpset::upset(
  upset_data,
  intersect = comparison_cols,
  base_annotations = list(
    'Intersection size' = (
      intersection_size(aes(fill = direction)) +
      scale_fill_manual(values = c("up" = "red", "down" = "blue"))
    )
  ),
  min_size = 10,
#  n_intersections = 20
)

#dev.off()

##Insect

###Formalisation des données Upset

select_cond=c("B_t1_Q11L, B_t1_Q11V_L", "B_t1_Q21L, B_t1_Q21V_L", "B_t2_Q11L,
              B_t2_Q11V_L", "B_t2_Q21L, B_t2_Q21V_L", "B_t1_Q11V_L, 
              B_t2_Q11V_L", "B_t1_Q21V_L, B_t2_Q21V_L", "B_t1_Q11L, B_t2_Q11L",
              "B_t1_Q21L, B_t2_Q21L", "B_t1_Q11L, B_t1_Q21L", "B_t1_Q11V_L,
              B_t1_Q21V_L", "B_t2_Q11L, B_t2_Q21L", "B_t2_Q11V_L, B_t2_Q21V_L")

list_sig_genes <- list()

for (i in seq_along(select_cond)) {
  ids <- strsplit(select_cond[i], ",\\s*")[[1]]
  ID1 <- ids[1]
  ID2 <- ids[2]
  
  res.F <- results(dds_bemisia.deseq, contrast = c("condition", ID1, ID2))
  res.F$padj <- p.adjust(res.F$pvalue, method = "fdr")
  res.F <- res.F[order(res.F$padj), ]
  
  sig_genes_up <- rownames(res.F)[which(res.F$padj < 0.05 & res.F$log2FoldChange >= 1)]
  sig_genes_down <- rownames(res.F)[which(res.F$padj < 0.05 & res.F$log2FoldChange <= -1)]
  
  name_comp <- paste0(ID1, "_vs_", ID2)
  
  df_up <- data.frame(gene = sig_genes_up, direction = "up", stringsAsFactors = FALSE)
  df_down <- data.frame(gene = sig_genes_down, direction = "down", stringsAsFactors = FALSE)
  
  list_sig_genes[[name_comp]] <- rbind(df_up, df_down)
}

# Obtenir tous les gènes significatifs
all_genes <- unique(unlist(lapply(list_sig_genes, function(df) df$gene)))

# Créer le tableau final
upset_data <- data.frame(gene = all_genes, stringsAsFactors = FALSE)

# Ajouter les colonnes de comparaison (1/0) et direction (par majorité si unique)
for (comp in names(list_sig_genes)) {
  genes <- list_sig_genes[[comp]]
  upset_data[[comp]] <- as.integer(upset_data$gene %in% genes$gene)
}

# Direction principale : si un gène est up ou down plus souvent
direction_vector <- sapply(upset_data$gene, function(g) {
  dirs <- unlist(lapply(list_sig_genes, function(df) {
    if (g %in% df$gene) df$direction[df$gene == g] else NULL
  }))
  if (length(dirs) == 0) return(NA)
  if (sum(dirs == "up") >= sum(dirs == "down")) return("up") else return("down")
})

upset_data$direction <- factor(direction_vector, levels = c("up", "down"))

comparison_cols <- setdiff(colnames(upset_data), c("gene", "direction"))

###Représentation graphique

#pdf("upset_insect.pdf")
ComplexUpset::upset(
  upset_data,
  intersect = comparison_cols,
  base_annotations = list(
    'Intersection size' = (
      intersection_size(aes(fill = direction)) +
      scale_fill_manual(values = c("up" = "red", "down" = "blue"))
    )
  ),
  min_size = 10,
#  n_intersections = 20
)

#dev.off()